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

Unified Diff: third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp

Issue 1615803004: Avoid double download for late discovered link preload resources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 11 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
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ResourceFetcher.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
index 0f6d48e7f03d9bf7106e1804c5d685c7c4f9617b..caa10e3692c9b015e3ebcb0a41efedc20d8daacb 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
@@ -181,7 +181,7 @@ ResourceFetcher::ResourceFetcher(FetchContext* context)
ResourceFetcher::~ResourceFetcher()
{
#if !ENABLE(OILPAN)
- clearPreloads();
+ clearPreloads(ClearAllPreloads);
#endif
}
@@ -834,7 +834,7 @@ bool ResourceFetcher::isPreloaded(const KURL& url) const
return false;
}
-void ResourceFetcher::clearPreloads()
+void ResourceFetcher::clearPreloads(ClearPreloadsPolicy policy)
{
#if PRELOAD_DEBUG
printPreloadStats();
@@ -845,7 +845,8 @@ void ResourceFetcher::clearPreloads()
for (auto resource : *m_preloads) {
resource->decreasePreloadCount();
bool deleted = resource->deleteIfPossible();
- if (!deleted && resource->preloadResult() == Resource::PreloadNotReferenced)
+ // avoidBlockingOnLoad is only set on non speculative preloads (i.e. <link rel=preload> triggered preloads)
+ if (!deleted && resource->preloadResult() == Resource::PreloadNotReferenced && (policy == ClearAllPreloads || !resource->avoidBlockingOnLoad()))
memoryCache()->remove(resource.get());
}
m_preloads.clear();
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ResourceFetcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698