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

Unified Diff: third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp

Issue 2542183002: Don't remove CSSPreloaderResourceClient for unused speculative markup preloads (Closed)
Patch Set: yhirano review Created 4 years 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/LayoutTests/TestExpectations ('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/html/parser/CSSPreloadScanner.cpp
diff --git a/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp b/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp
index 920d5b80baed70ae291b6dbfe054b5a447c1a01d..217d38988c3550d4efe8b1ec1297ea1856bcc019 100644
--- a/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp
+++ b/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp
@@ -320,6 +320,18 @@ void CSSPreloaderResourceClient::fetchPreloads(PreloadRequestStream& preloads) {
}
void CSSPreloaderResourceClient::clearResource() {
+ // Do not remove the client for unused, speculative markup preloads. This will
+ // trigger cancellation of the request and potential removal from memory
+ // cache. Link preloads are an exception because they support dynamic removal
+ // cancelling the request (and have their own passive resource client).
+ // Note: Speculative preloads which remain unused for their lifetime will
+ // never have this client removed. This should be fine because we only hold
+ // weak references to the resource.
+ if (m_resource && m_resource->isUnusedPreload() &&
+ !m_resource->isLinkPreload()) {
+ return;
+ }
+
if (m_resource)
m_resource->removeClient(this);
m_resource.clear();
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698