| 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();
|
|
|