Chromium Code Reviews| Index: Source/core/html/parser/HTMLScriptRunner.cpp |
| diff --git a/Source/core/html/parser/HTMLScriptRunner.cpp b/Source/core/html/parser/HTMLScriptRunner.cpp |
| index 4e1da540a73b334182b6a95a4fcf32e75c74037a..48b06ca5a7feb427c9744e8dc3f27b57c64d7771 100644 |
| --- a/Source/core/html/parser/HTMLScriptRunner.cpp |
| +++ b/Source/core/html/parser/HTMLScriptRunner.cpp |
| @@ -109,6 +109,8 @@ bool HTMLScriptRunner::isPendingScriptReady(const PendingScript& script) |
| return false; |
| if (script.resource() && !script.resource()->isLoaded()) |
| return false; |
| + if (script.isStreaming()) |
| + return false; |
| return true; |
| } |
| @@ -167,6 +169,10 @@ void HTMLScriptRunner::executePendingScriptAndDispatchEvent(PendingScript& pendi |
| void HTMLScriptRunner::notifyFinished(Resource* cachedResource) |
| { |
| + // For a parser-blocking script, this function should be called only when |
| + // the streaming is complete. |
| + ASSERT(!(m_parserBlockingScript.resource() == cachedResource |
| + && m_parserBlockingScript.isStreaming())); |
| m_host->notifyScriptLoaded(cachedResource); |
| } |
| @@ -255,8 +261,11 @@ void HTMLScriptRunner::requestParsingBlockingScript(Element* element) |
| // We only care about a load callback if resource is not already |
| // in the cache. Callers will attempt to run the m_parserBlockingScript |
| // if possible before returning control to the parser. |
| - if (!m_parserBlockingScriptAlreadyLoaded) |
| + if (!m_parserBlockingScriptAlreadyLoaded) { |
| + bool startedStreaming = ScriptStreamer::startStreaming(m_parserBlockingScript, m_document->frame()->settings(), ScriptState::forMainWorld(m_document->frame())); |
| + blink::Platform::current()->histogramEnumeration("WebCore.Scripts.ParsingBlocking.StartedStreaming", startedStreaming ? 1 : 0, 2); |
|
haraken
2014/09/11 16:12:30
Did you already land a chromium side change?
marja
2014/09/15 17:45:27
No, but I can land this before it without problems
|
| m_parserBlockingScript.watchForLoad(this); |
| + } |
| } |
| void HTMLScriptRunner::requestDeferredScript(Element* element) |
| @@ -314,6 +323,8 @@ void HTMLScriptRunner::runScript(Element* script, const TextPosition& scriptStar |
| return; |
| if (scriptLoader->willExecuteWhenDocumentFinishedParsing()) { |
| + // FIXME: in addition to parser blocking scripts, stream also |
| + // scripts which are not parser blocking. |
| requestDeferredScript(script); |
| } else if (scriptLoader->readyToBeParserExecuted()) { |
| if (m_scriptNestingLevel == 1) { |