Index: third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp |
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp b/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp |
index 7909e8d1155b93df5f0d9a466483ea6966b049af..65df036e01d24e8d73048c2253bef0870ffa521b 100644 |
--- a/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp |
+++ b/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp |
@@ -79,14 +79,16 @@ std::unique_ptr<TracedValue> getTraceArgsForScriptElement( |
bool doExecuteScript(Element* scriptElement, |
const ScriptSourceCode& sourceCode, |
- const TextPosition& textPosition) { |
+ const TextPosition& textPosition, |
+ CompiledScript* compiledScript = nullptr) { |
ScriptLoader* scriptLoader = toScriptLoaderIfPossible(scriptElement); |
DCHECK(scriptLoader); |
- TRACE_EVENT_WITH_FLOW1( |
+ TRACE_EVENT_WITH_FLOW2( |
"blink", "HTMLParserScriptRunner ExecuteScript", scriptElement, |
TRACE_EVENT_FLAG_FLOW_IN, "data", |
- getTraceArgsForScriptElement(scriptElement, textPosition)); |
- return scriptLoader->executeScript(sourceCode); |
+ getTraceArgsForScriptElement(scriptElement, textPosition), |
+ "compiledScript", compiledScript); |
+ return scriptLoader->executeScript(sourceCode, compiledScript); |
} |
void traceParserBlockingScript(const PendingScript* pendingScript, |
@@ -226,6 +228,7 @@ void HTMLParserScriptRunner::executePendingScriptAndDispatchEvent( |
double scriptParserBlockingTime = |
pendingScript->parserBlockingLoadStartTime(); |
Element* element = pendingScript->element(); |
+ CompiledScript* compiledScript = pendingScript->getCompiledScript(); |
// 1. "Let the script be the pending parsing-blocking script. |
// There is no longer a pending parsing-blocking script." |
@@ -262,7 +265,8 @@ void HTMLParserScriptRunner::executePendingScriptAndDispatchEvent( |
monotonicallyIncreasingTime() - scriptParserBlockingTime, |
scriptLoader->wasCreatedDuringDocumentWrite()); |
} |
- if (!doExecuteScript(element, sourceCode, scriptStartPosition)) { |
+ if (!doExecuteScript(element, sourceCode, scriptStartPosition, |
+ compiledScript)) { |
scriptLoader->dispatchErrorEvent(); |
} else { |
element->dispatchEvent(Event::create(EventTypeNames::load)); |
@@ -355,6 +359,9 @@ void HTMLParserScriptRunner::possiblyFetchBlockedDocWriteScript( |
void HTMLParserScriptRunner::pendingScriptFinished( |
PendingScript* pendingScript) { |
+ LOG(ERROR) << "Finished loading pending script of size " |
+ << pendingScript->resource()->size(); |
+ |
// Handle cancellations of parser-blocking script loads without |
// notifying the host (i.e., parser) if these were initiated by nested |
// document.write()s. The cancellation may have been triggered by |
@@ -666,6 +673,7 @@ void HTMLParserScriptRunner::processScriptElementInternal( |
// "Immediately execute the script block, |
// even if other scripts are already executing." |
// TODO(hiroshige): Merge the block into ScriptLoader::prepareScript(). |
+ TRACE_EVENT0("blink", "HTMLParserScriptRunner immediate-execute"); |
DCHECK_GT(m_reentryPermit->scriptNestingLevel(), 1u); |
if (m_parserBlockingScript) |
m_parserBlockingScript->dispose(); |