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

Unified Diff: third_party/WebKit/Source/core/css/StyleRuleImport.cpp

Issue 1667843003: Make Resource RefCountedWillBeGarbageCollectedFinalized, attempt #2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + address review comments Created 4 years, 10 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
Index: third_party/WebKit/Source/core/css/StyleRuleImport.cpp
diff --git a/third_party/WebKit/Source/core/css/StyleRuleImport.cpp b/third_party/WebKit/Source/core/css/StyleRuleImport.cpp
index cc09ce76f576ac76522f6a31ba263ce8e7ef16d4..b252d3fb84221d53fa0d21e63a64174e2db32496 100644
--- a/third_party/WebKit/Source/core/css/StyleRuleImport.cpp
+++ b/third_party/WebKit/Source/core/css/StyleRuleImport.cpp
@@ -41,11 +41,14 @@ StyleRuleImport::StyleRuleImport(const String& href, PassRefPtrWillBeRawPtr<Medi
, m_styleSheetClient(this)
, m_strHref(href)
, m_mediaQueries(media)
- , m_resource(nullptr)
, m_loading(false)
{
if (!m_mediaQueries)
m_mediaQueries = MediaQuerySet::create(String());
+
+#if ENABLE(OILPAN)
+ ThreadState::current()->registerPreFinalizer(this);
+#endif
}
StyleRuleImport::~StyleRuleImport()
@@ -53,9 +56,15 @@ StyleRuleImport::~StyleRuleImport()
#if !ENABLE(OILPAN)
if (m_styleSheet)
m_styleSheet->clearOwnerRule();
+ dispose();
#endif
+}
+
+void StyleRuleImport::dispose()
+{
if (m_resource)
m_resource->removeClient(&m_styleSheetClient);
+ m_resource = nullptr;
}
DEFINE_TRACE_AFTER_DISPATCH(StyleRuleImport)
@@ -64,6 +73,7 @@ DEFINE_TRACE_AFTER_DISPATCH(StyleRuleImport)
visitor->trace(m_parentStyleSheet);
visitor->trace(m_mediaQueries);
visitor->trace(m_styleSheet);
+ visitor->trace(m_resource);
StyleRuleBase::traceAfterDispatch(visitor);
}
« no previous file with comments | « third_party/WebKit/Source/core/css/StyleRuleImport.h ('k') | third_party/WebKit/Source/core/dom/PendingScript.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698