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

Unified Diff: third_party/WebKit/Source/core/dom/ScriptRunner.cpp

Issue 2238543002: Instrument parser blocking script execution time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test Created 4 years, 4 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/dom/ScriptRunner.cpp
diff --git a/third_party/WebKit/Source/core/dom/ScriptRunner.cpp b/third_party/WebKit/Source/core/dom/ScriptRunner.cpp
index 317ce05e0fc46b52fe62cb63d936b495d201b36a..566b95d2372a1d3091ccd2a2880511c1bb28793c 100644
--- a/third_party/WebKit/Source/core/dom/ScriptRunner.cpp
+++ b/third_party/WebKit/Source/core/dom/ScriptRunner.cpp
@@ -48,19 +48,22 @@ ScriptRunner::ScriptRunner(Document* document)
#endif
}
-void ScriptRunner::queueScriptForExecution(ScriptLoader* scriptLoader, ExecutionType executionType)
+void ScriptRunner::queueScriptForExecution(ScriptLoader* scriptLoader, AsyncExecutionType executionType)
{
DCHECK(scriptLoader);
m_document->incrementLoadEventDelayCount();
switch (executionType) {
- case ASYNC_EXECUTION:
+ case AsyncExecution:
m_pendingAsyncScripts.add(scriptLoader);
break;
- case IN_ORDER_EXECUTION:
+ case InOrderExecution:
m_pendingInOrderScripts.append(scriptLoader);
m_numberOfInOrderScriptsWithPendingNotification++;
break;
+ case NoExecType:
+ NOTREACHED();
+ break;
}
}
@@ -104,11 +107,11 @@ void ScriptRunner::scheduleReadyInOrderScripts()
}
}
-void ScriptRunner::notifyScriptReady(ScriptLoader* scriptLoader, ExecutionType executionType)
+void ScriptRunner::notifyScriptReady(ScriptLoader* scriptLoader, AsyncExecutionType executionType)
{
SECURITY_CHECK(scriptLoader);
switch (executionType) {
- case ASYNC_EXECUTION:
+ case AsyncExecution:
// RELEASE_ASSERT makes us crash in a controlled way in error cases
// where the ScriptLoader is associated with the wrong ScriptRunner
// (otherwise we'd cause a use-after-free in ~ScriptRunner when it tries
@@ -122,13 +125,16 @@ void ScriptRunner::notifyScriptReady(ScriptLoader* scriptLoader, ExecutionType e
break;
- case IN_ORDER_EXECUTION:
+ case InOrderExecution:
SECURITY_CHECK(m_numberOfInOrderScriptsWithPendingNotification > 0);
m_numberOfInOrderScriptsWithPendingNotification--;
scheduleReadyInOrderScripts();
break;
+ case NoExecType:
+ NOTREACHED();
+ break;
}
}
@@ -145,10 +151,10 @@ bool ScriptRunner::removePendingInOrderScript(ScriptLoader* scriptLoader)
return false;
}
-void ScriptRunner::notifyScriptLoadError(ScriptLoader* scriptLoader, ExecutionType executionType)
+void ScriptRunner::notifyScriptLoadError(ScriptLoader* scriptLoader, AsyncExecutionType executionType)
{
switch (executionType) {
- case ASYNC_EXECUTION: {
+ case AsyncExecution: {
// SECURITY_CHECK makes us crash in a controlled way in error cases
// where the ScriptLoader is associated with the wrong ScriptRunner
// (otherwise we'd cause a use-after-free in ~ScriptRunner when it tries
@@ -157,10 +163,13 @@ void ScriptRunner::notifyScriptLoadError(ScriptLoader* scriptLoader, ExecutionTy
m_pendingAsyncScripts.remove(scriptLoader);
break;
}
- case IN_ORDER_EXECUTION:
+ case InOrderExecution:
SECURITY_CHECK(removePendingInOrderScript(scriptLoader));
scheduleReadyInOrderScripts();
break;
+ case NoExecType:
+ NOTREACHED();
+ break;
}
m_document->decrementLoadEventDelayCount();
}
@@ -194,13 +203,13 @@ void ScriptRunner::movePendingScript(Document& oldDocument, Document& newDocumen
void ScriptRunner::movePendingScript(ScriptRunner* newRunner, ScriptLoader* scriptLoader)
{
if (m_pendingAsyncScripts.contains(scriptLoader)) {
- newRunner->queueScriptForExecution(scriptLoader, ASYNC_EXECUTION);
+ newRunner->queueScriptForExecution(scriptLoader, AsyncExecution);
m_pendingAsyncScripts.remove(scriptLoader);
m_document->decrementLoadEventDelayCount();
return;
}
if (removePendingInOrderScript(scriptLoader)) {
- newRunner->queueScriptForExecution(scriptLoader, IN_ORDER_EXECUTION);
+ newRunner->queueScriptForExecution(scriptLoader, InOrderExecution);
m_document->decrementLoadEventDelayCount();
}
}

Powered by Google App Engine
This is Rietveld 408576698