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

Unified Diff: third_party/WebKit/Source/core/dom/ScriptLoader.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/dom/ScriptLoader.cpp
diff --git a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
index 28469a5b6675de8737028a991d0cde231dafe156..910288e42f2bec6332d65f4357934511c9adc49d 100644
--- a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
+++ b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
@@ -59,7 +59,6 @@ namespace blink {
ScriptLoader::ScriptLoader(Element* element, bool parserInserted, bool alreadyStarted)
: m_element(element)
- , m_resource(0)
, m_startLineNumber(WTF::OrdinalNumber::beforeFirst())
, m_parserInserted(parserInserted)
, m_isExternalScript(false)
@@ -74,21 +73,16 @@ ScriptLoader::ScriptLoader(Element* element, bool parserInserted, bool alreadySt
ASSERT(m_element);
if (parserInserted && element->document().scriptableDocumentParser() && !element->document().isInDocumentWrite())
m_startLineNumber = element->document().scriptableDocumentParser()->lineNumber();
-#if ENABLE(OILPAN)
- ThreadState::current()->registerPreFinalizer(this);
-#endif
}
ScriptLoader::~ScriptLoader()
{
-#if !ENABLE(OILPAN)
- detach();
-#endif
}
DEFINE_TRACE(ScriptLoader)
{
visitor->trace(m_element);
+ visitor->trace(m_resource);
visitor->trace(m_pendingScript);
}
@@ -121,8 +115,7 @@ void ScriptLoader::detach()
{
if (!m_pendingScript)
return;
- m_pendingScript->stopWatchingForLoad(this);
- m_pendingScript->releaseElementAndClear();
+ m_pendingScript->dispose();
m_pendingScript = nullptr;
}
@@ -454,7 +447,7 @@ void ScriptLoader::execute()
else
dispatchErrorEvent();
}
- m_resource = 0;
+ m_resource = nullptr;
}
void ScriptLoader::notifyFinished(Resource* resource)
@@ -481,7 +474,7 @@ void ScriptLoader::notifyFinished(Resource* resource)
return;
}
contextDocument->scriptRunner()->notifyScriptReady(this, runOrder);
- m_pendingScript->stopWatchingForLoad(this);
+ m_pendingScript->stopWatchingForLoad();
}
bool ScriptLoader::ignoresLoadRequest() const
« no previous file with comments | « third_party/WebKit/Source/core/dom/ScriptLoader.h ('k') | third_party/WebKit/Source/core/dom/ScriptRunner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698