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

Unified Diff: third_party/WebKit/Source/core/dom/PendingScript.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/PendingScript.cpp
diff --git a/third_party/WebKit/Source/core/dom/PendingScript.cpp b/third_party/WebKit/Source/core/dom/PendingScript.cpp
index 954ea06e14a993e0195462334a22788cae6ad43d..ecd2d8c6954f1339007a4eabd69553483693e084 100644
--- a/third_party/WebKit/Source/core/dom/PendingScript.cpp
+++ b/third_party/WebKit/Source/core/dom/PendingScript.cpp
@@ -66,7 +66,7 @@ void PendingScript::dispose() {
m_element = nullptr;
}
-void PendingScript::watchForLoad(ScriptResourceClient* client) {
+void PendingScript::watchForLoad(PendingScriptClient* client) {
DCHECK(!m_watchingForLoad);
// addClient() will call streamingFinished() if the load is complete. Callers
// who do not expect to be re-entered from this call should not call
@@ -75,16 +75,14 @@ void PendingScript::watchForLoad(ScriptResourceClient* client) {
// notifyFinished and further stopWatchingForLoad().
m_watchingForLoad = true;
m_client = client;
- if (!m_streamer)
- resource()->addClient(client);
+ if (isReady())
+ m_client->pendingScriptFinished(this);
}
void PendingScript::stopWatchingForLoad() {
if (!m_watchingForLoad)
return;
DCHECK(resource());
- if (!m_streamer)
- resource()->removeClient(m_client);
m_client = nullptr;
m_watchingForLoad = false;
}
@@ -92,7 +90,7 @@ void PendingScript::stopWatchingForLoad() {
void PendingScript::streamingFinished() {
DCHECK(resource());
if (m_client)
- m_client->notifyFinished(resource());
+ m_client->pendingScriptFinished(this);
kouhei (in TOK) 2016/12/12 01:37:05 Wow. Thanks for this change. Old code abusing Scri
}
void PendingScript::setElement(Element* element) {
@@ -164,8 +162,12 @@ void PendingScript::notifyFinished(Resource* resource) {
}
}
+ // If script streaming is in use, the client will be notified in
+ // streamingFinished.
if (m_streamer)
m_streamer->notifyFinished(resource);
+ else if (m_client)
+ m_client->pendingScriptFinished(this);
}
void PendingScript::notifyAppendData(ScriptResource* resource) {
« no previous file with comments | « third_party/WebKit/Source/core/dom/PendingScript.h ('k') | third_party/WebKit/Source/core/dom/ScriptLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698