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

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

Issue 2542183002: Don't remove CSSPreloaderResourceClient for unused speculative markup preloads (Closed)
Patch Set: allow dynamic link preload removal 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/fetch/Resource.cpp
diff --git a/third_party/WebKit/Source/core/fetch/Resource.cpp b/third_party/WebKit/Source/core/fetch/Resource.cpp
index 8968aeca01cac2fd5c0e9d819f85d23ddcf7da6d..26e48ddf2b1ade1e1883640f537f085a45e92cd0 100644
--- a/third_party/WebKit/Source/core/fetch/Resource.cpp
+++ b/third_party/WebKit/Source/core/fetch/Resource.cpp
@@ -754,20 +754,26 @@ void Resource::removeClient(ResourceClient* client) {
}
void Resource::didRemoveClientOrObserver() {
- if (!hasClientsOrObservers() && m_isAlive) {
- m_isAlive = false;
- allClientsAndObserversRemoved();
-
- // RFC2616 14.9.2:
- // "no-store: ... MUST make a best-effort attempt to remove the information
- // from volatile storage as promptly as possible"
- // "... History buffers MAY store such responses as part of their normal
- // operation."
- // We allow non-secure content to be reused in history, but we do not allow
- // secure content to be reused.
- if (hasCacheControlNoStoreHeader() && url().protocolIs("https"))
- memoryCache()->remove(this);
- }
+ if (hasClientsOrObservers() || !m_isAlive)
+ return;
+
+ // Allow speculative markup preloads to continue even without clients or
+ // observers. Their lifetime is determined by the ResourceFetcher.
+ if (isUnusedPreload() && !isLinkPreload())
yhirano 2016/12/02 01:32:25 Is it possible to register a ResourceClient instea
Charlie Harrison 2016/12/02 04:20:22 Hm... so the CSSPreloaderResourceClient removes it
yhirano 2016/12/02 08:50:29 Then is it possible to stop removing itself only w
Charlie Harrison 2016/12/02 13:14:15 I think it might be possible now that CSSPreloader
+ return;
+
+ m_isAlive = false;
+ allClientsAndObserversRemoved();
+
+ // RFC2616 14.9.2:
+ // "no-store: ... MUST make a best-effort attempt to remove the information
+ // from volatile storage as promptly as possible"
+ // "... History buffers MAY store such responses as part of their normal
+ // operation."
+ // We allow non-secure content to be reused in history, but we do not allow
+ // secure content to be reused.
+ if (hasCacheControlNoStoreHeader() && url().protocolIs("https"))
+ memoryCache()->remove(this);
}
void Resource::allClientsAndObserversRemoved() {
« 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