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

Unified Diff: third_party/WebKit/Source/core/dom/ScriptLoader.cpp

Issue 2549143009: Create PendingScriptClient as a separate client interface for PendingScript. (Closed)
Patch Set: . 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
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 a02e2ca2086a275cb4d1cf3ef5647e11e0236ce3..7b3915aaac0eec2ae7e42d89ecbea6a1915a3734 100644
--- a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
+++ b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
@@ -91,7 +91,7 @@ DEFINE_TRACE(ScriptLoader) {
visitor->trace(m_element);
visitor->trace(m_resource);
visitor->trace(m_pendingScript);
- ScriptResourceClient::trace(visitor);
+ PendingScriptClient::trace(visitor);
}
void ScriptLoader::setFetchDocWrittenScriptDeferIdle() {
@@ -291,7 +291,7 @@ bool ScriptLoader::prepareScript(const TextPosition& scriptStartPosition,
m_asyncExecType = ScriptRunner::InOrder;
contextDocument->scriptRunner()->queueScriptForExecution(this,
m_asyncExecType);
- // Note that watchForLoad can immediately call notifyFinished.
+ // Note that watchForLoad can immediately call pendingScriptFinished.
m_pendingScript->watchForLoad(this);
} else if (client->hasSourceAttribute()) {
m_pendingScript = PendingScript::create(m_element, m_resource.get());
@@ -306,7 +306,7 @@ bool ScriptLoader::prepareScript(const TextPosition& scriptStartPosition,
}
contextDocument->scriptRunner()->queueScriptForExecution(this,
m_asyncExecType);
- // Note that watchForLoad can immediately call notifyFinished.
+ // Note that watchForLoad can immediately call pendingScriptFinished.
m_pendingScript->watchForLoad(this);
} else {
// Reset line numbering for nested writes.
@@ -573,8 +573,9 @@ void ScriptLoader::execute() {
m_resource = nullptr;
}
-void ScriptLoader::notifyFinished(Resource* resource) {
+void ScriptLoader::pendingScriptFinished(PendingScript* pendingScript) {
DCHECK(!m_willBeParserExecuted);
+ DCHECK_EQ(m_pendingScript, pendingScript);
// We do not need this script in the memory cache. The primary goals of
// sending this fetch request are to let the third party server know
@@ -582,7 +583,7 @@ void ScriptLoader::notifyFinished(Resource* resource) {
// cache for subsequent uses.
if (m_documentWriteIntervention ==
DocumentWriteIntervention::FetchDocWrittenScriptDeferIdle) {
- memoryCache()->remove(resource);
+ memoryCache()->remove(m_pendingScript->resource());
m_pendingScript->stopWatchingForLoad();
return;
}
@@ -595,7 +596,7 @@ void ScriptLoader::notifyFinished(Resource* resource) {
return;
}
- DCHECK_EQ(resource, m_resource);
+ DCHECK_EQ(pendingScript->resource(), m_resource);
if (m_resource->errorOccurred()) {
contextDocument->scriptRunner()->notifyScriptLoadError(this,

Powered by Google App Engine
This is Rietveld 408576698