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

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

Issue 2174563003: Clear all preloads when document is detached (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 4 years, 4 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 e31018cc8d8f4776e0afcfba786ac6152a05a333..76f39f123ad988d54669e81eef06fcd2ebab40cb 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
@@ -850,6 +850,12 @@ void ResourceFetcher::reloadImagesIfNotDeferred()
}
}
+void ResourceFetcher::clearContext()
+{
+ clearPreloads(ResourceFetcher::ClearAllPreloads);
+ m_context.clear();
+}
+
int ResourceFetcher::requestCount() const
{
return m_loaders.size();
@@ -887,11 +893,15 @@ void ResourceFetcher::clearPreloads(ClearPreloadsPolicy policy)
logPreloadStats();
for (auto resource : *m_preloads) {
- resource->decreasePreloadCount();
- if (resource->getPreloadResult() == Resource::PreloadNotReferenced && (policy == ClearAllPreloads || !resource->isLinkPreload()))
- memoryCache()->remove(resource.get());
+ if (policy == ClearAllPreloads || !resource->isLinkPreload()) {
+ resource->decreasePreloadCount();
+ if (resource->getPreloadResult() == Resource::PreloadNotReferenced)
+ memoryCache()->remove(resource.get());
+ m_preloads->remove(resource);
+ }
}
- m_preloads.clear();
+ if (!m_preloads->size())
+ m_preloads.clear();
}
ArchiveResource* ResourceFetcher::createArchive(Resource* resource)
« 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