Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Unified Diff: third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp

Issue 2845513002: [WIP] Add Resource::IsShareable
Patch Set: fix Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
index cd0a108eb988ad8e718cee8bf8218c1e2bced0de..98584e2a3686f00920d2a142bdf8fe90199f5fd5 100644
--- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
@@ -442,7 +442,7 @@ Resource* ResourceFetcher::ResourceForStaticData(
resource->SetCacheIdentifier(cache_identifier);
resource->Finish();
- if (!substitute_data.IsValid())
+ if (!substitute_data.IsValid() && resource->IsShareable())
GetMemoryCache()->Add(resource);
return resource;
@@ -797,12 +797,8 @@ Resource* ResourceFetcher::CreateResourceForLoading(
}
resource->SetCacheIdentifier(cache_identifier);
- // - Don't add main resource to cache to prevent reuse.
- // - Don't add the resource if its body will not be stored.
- if (IsMainThread() && factory.GetType() != Resource::kMainResource &&
- params.Options().data_buffering_policy != kDoNotBufferData) {
+ if (resource->IsShareable())
GetMemoryCache()->Add(resource);
- }
return resource;
}

Powered by Google App Engine
This is Rietveld 408576698