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

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

Issue 2452413002: Make CSSPreloaderResourceClient hold weak references to its resource (Closed)
Patch Set: Created 4 years, 2 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/html/parser/CSSPreloadScanner.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/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 2e50772cdedf25c2204dfc4214c549fca0f173a7..ea1841ac35bcc37c02960f148c1a1d296a2cec74 100644
--- a/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp
+++ b/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp
@@ -255,10 +255,9 @@ CSSPreloaderResourceClient::CSSPreloaderResourceClient(
: m_policy(preloader->document()->settings()->cssExternalScannerPreload()
? ScanAndPreload
: ScanOnly),
- m_preloader(preloader) {
- DCHECK(resource->getType() == Resource::Type::CSSStyleSheet);
- setResource(toCSSStyleSheetResource(resource),
- Resource::DontMarkAsReferenced);
+ m_preloader(preloader),
+ m_resource(toCSSStyleSheetResource(resource)) {
Yoav Weiss 2016/10/27 21:59:49 Can you bring back the DCHECK?
Charlie Harrison 2016/10/27 22:34:01 AFAICT the to<Resource> type casts do this already
+ m_resource->addClient(this);
}
CSSPreloaderResourceClient::~CSSPreloaderResourceClient() {}
@@ -320,9 +319,16 @@ void CSSPreloaderResourceClient::fetchPreloads(PreloadRequestStream& preloads) {
}
}
+void CSSPreloaderResourceClient::clearResource() {
+ if (m_resource)
+ m_resource->removeClient(this);
+ m_resource.clear();
+}
+
DEFINE_TRACE(CSSPreloaderResourceClient) {
visitor->trace(m_preloader);
- ResourceOwner<CSSStyleSheetResource>::trace(visitor);
+ visitor->trace(m_resource);
+ StyleSheetResourceClient::trace(visitor);
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698