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

Unified Diff: third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp

Issue 2780463002: Introduce blink::Script (Closed)
Patch Set: style Created 3 years, 8 months 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/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 552799c02c09e3fd9aa4fe7cf57efc5b01220820..c52eb9f092687a1894f1a17a2f67f38030bade00 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp
@@ -31,6 +31,7 @@
#include "bindings/core/v8/ScriptSourceCode.h"
#include "bindings/core/v8/V8Binding.h"
#include "bindings/core/v8/V8PerIsolateData.h"
+#include "core/dom/ClassicScript.h"
#include "core/dom/DocumentParserTiming.h"
#include "core/dom/Element.h"
#include "core/dom/IgnoreDestructiveWriteCountIncrementer.h"
@@ -79,14 +80,14 @@ std::unique_ptr<TracedValue> getTraceArgsForScriptElement(
}
bool doExecuteScript(ScriptElementBase* element,
- const ScriptSourceCode& sourceCode,
+ const Script* script,
const TextPosition& textPosition) {
ScriptLoader* scriptLoader = element->loader();
DCHECK(scriptLoader);
TRACE_EVENT_WITH_FLOW1("blink", "HTMLParserScriptRunner ExecuteScript",
element, TRACE_EVENT_FLAG_FLOW_IN, "data",
getTraceArgsForScriptElement(element, textPosition));
- return scriptLoader->executeScript(sourceCode);
+ return scriptLoader->executeScript(script);
}
void traceParserBlockingScript(const PendingScript* pendingScript,
@@ -203,7 +204,7 @@ void HTMLParserScriptRunner::executePendingScriptAndDispatchEvent(
PendingScript* pendingScript,
ScriptStreamer::Type pendingScriptType) {
bool errorOccurred = false;
- ScriptSourceCode sourceCode = pendingScript->getSource(
+ Script* script = pendingScript->getSource(
documentURLForScriptExecution(m_document), errorOccurred);
// Stop watching loads before executeScript to prevent recursion if the script
@@ -262,7 +263,7 @@ void HTMLParserScriptRunner::executePendingScriptAndDispatchEvent(
monotonicallyIncreasingTime() - scriptParserBlockingTime,
scriptLoader->wasCreatedDuringDocumentWrite());
}
- if (!doExecuteScript(element, sourceCode, scriptStartPosition)) {
+ if (!doExecuteScript(element, script, scriptStartPosition)) {
scriptLoader->dispatchErrorEvent();
} else {
element->dispatchLoadEvent();
@@ -672,7 +673,8 @@ void HTMLParserScriptRunner::processScriptElementInternal(
ScriptSourceCode sourceCode(script->textContent(),
documentURLForScriptExecution(m_document),
scriptStartPosition);
- doExecuteScript(element, sourceCode, scriptStartPosition);
+ doExecuteScript(element, ClassicScript::create(sourceCode),
+ scriptStartPosition);
}
} else {
// 2nd Clause of Step 23.

Powered by Google App Engine
This is Rietveld 408576698