Chromium Code Reviews| 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) { |