diff --git a/build/patches/Partition-Blink-memory-cache.patch b/build/patches/Partition-Blink-memory-cache.patch index d229d8c0..011b30be 100644 --- a/build/patches/Partition-Blink-memory-cache.patch +++ b/build/patches/Partition-Blink-memory-cache.patch @@ -16,13 +16,13 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- .../core/html/parser/html_srcset_parser.cc | 2 +- .../core/inspector/inspector_network_agent.cc | 2 +- - .../core/inspector/inspector_page_agent.cc | 4 ++-- + .../core/inspector/inspector_page_agent.cc | 4 +-- .../renderer/core/loader/image_loader.cc | 3 ++- - .../platform/loader/fetch/memory_cache.cc | 8 ++------ - .../platform/loader/fetch/memory_cache.h | 5 ++--- - .../platform/loader/fetch/resource_fetcher.cc | 19 +++++++++++++------ - .../platform/loader/fetch/resource_fetcher.h | 3 ++- - 8 files changed, 25 insertions(+), 21 deletions(-) + .../platform/loader/fetch/memory_cache.cc | 8 ++---- + .../platform/loader/fetch/memory_cache.h | 5 ++-- + .../platform/loader/fetch/resource_fetcher.cc | 27 ++++++++++++++----- + .../platform/loader/fetch/resource_fetcher.h | 5 +++- + 8 files changed, 35 insertions(+), 21 deletions(-) diff --git a/third_party/blink/renderer/core/html/parser/html_srcset_parser.cc b/third_party/blink/renderer/core/html/parser/html_srcset_parser.cc --- a/third_party/blink/renderer/core/html/parser/html_srcset_parser.cc @@ -129,43 +129,51 @@ diff --git a/third_party/blink/renderer/platform/loader/fetch/memory_cache.h b/t diff --git a/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc b/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc --- a/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc +++ b/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc -@@ -992,7 +992,8 @@ Resource* ResourceFetcher::CreateResourceForStaticData( +@@ -992,7 +992,7 @@ Resource* ResourceFetcher::CreateResourceForStaticData( if (!archive_ && factory.GetType() == ResourceType::kRaw) return nullptr; - const String cache_identifier = GetCacheIdentifier(url); -+ const String cache_identifier = GetCacheIdentifier(url, -+ params.GetResourceRequest().TopFrameOrigin()); ++ const String cache_identifier = GetCacheIdentifier(url, params.GetResourceRequest()); // Most off-main-thread resource fetches use Resource::kRaw and don't reach // this point, but off-main-thread module fetches might. if (IsMainThread()) { -@@ -1408,7 +1409,9 @@ Resource* ResourceFetcher::RequestResource(FetchParameters& params, +@@ -1408,7 +1408,8 @@ Resource* ResourceFetcher::RequestResource(FetchParameters& params, MakePreloadedResourceBlockOnloadIfNeeded(resource, params); } else if (IsMainThread()) { resource = MemoryCache::Get()->ResourceForURL( - params.Url(), GetCacheIdentifier(params.Url())); + params.Url(), -+ GetCacheIdentifier(params.Url(), -+ params.GetResourceRequest().TopFrameOrigin())); ++ GetCacheIdentifier(params.Url(), params.GetResourceRequest())); if (resource) { policy = DetermineRevalidationPolicy(resource_type, params, *resource, is_static_data); -@@ -1719,7 +1722,8 @@ Resource* ResourceFetcher::CreateResourceForLoading( +@@ -1719,7 +1720,8 @@ Resource* ResourceFetcher::CreateResourceForLoading( const FetchParameters& params, const ResourceFactory& factory) { const String cache_identifier = - GetCacheIdentifier(params.GetResourceRequest().Url()); + GetCacheIdentifier(params.GetResourceRequest().Url(), -+ params.GetResourceRequest().TopFrameOrigin()); ++ params.GetResourceRequest()); DCHECK(!IsMainThread() || params.IsStaleRevalidation() || !MemoryCache::Get()->ResourceForURL(params.GetResourceRequest().Url(), cache_identifier)); -@@ -2788,10 +2792,13 @@ void ResourceFetcher::UpdateAllImageResourcePriorities() { +@@ -2788,10 +2790,23 @@ void ResourceFetcher::UpdateAllImageResourcePriorities() { to_be_removed.clear(); } -String ResourceFetcher::GetCacheIdentifier(const KURL& url) const { +String ResourceFetcher::GetCacheIdentifier(const KURL& url, ++ const ResourceRequest& resource_request) const { ++ if (const scoped_refptr top_origin = resource_request.TopFrameOrigin()) { ++ return ResourceFetcher::GetCacheIdentifier(url, top_origin); ++ } else if (const scoped_refptr requestor_origin = resource_request.RequestorOrigin()) { ++ return ResourceFetcher::GetCacheIdentifier(url, requestor_origin); ++ } ++ NOTREACHED(); ++} ++ ++String ResourceFetcher::GetCacheIdentifier(const KURL& url, + scoped_refptr origin) const { + String origin_url = origin ? origin->ToRawString() : ""; + @@ -176,7 +184,7 @@ diff --git a/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.c } // Requests that can be satisfied via `archive_` (i.e. MHTML) or -@@ -2804,7 +2811,7 @@ String ResourceFetcher::GetCacheIdentifier(const KURL& url) const { +@@ -2804,7 +2819,7 @@ String ResourceFetcher::GetCacheIdentifier(const KURL& url) const { if (bundle) return bundle->GetCacheIdentifier(); @@ -188,13 +196,15 @@ diff --git a/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.c diff --git a/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h b/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h --- a/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h +++ b/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h -@@ -278,7 +278,8 @@ class PLATFORM_EXPORT ResourceFetcher +@@ -278,7 +278,10 @@ class PLATFORM_EXPORT ResourceFetcher uint32_t inflight_keepalive_bytes); blink::mojom::ControllerServiceWorkerMode IsControlledByServiceWorker() const; - String GetCacheIdentifier(const KURL& url) const; + String GetCacheIdentifier(const KURL& url, -+ scoped_refptr cache_identifier) const; ++ const ResourceRequest& resource_request) const; ++ String GetCacheIdentifier(const KURL& url, ++ scoped_refptr origin) const; // If `url` exists as a resource in a subresource bundle in this frame, // returns its UnguessableToken; otherwise, returns std::nullopt.