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

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: address comments Created 4 years, 3 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..3df6f7fb2d8ac26f3eb2115f96a4e362e7b79a14 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 Async:
m_pendingAsyncScripts.add(scriptLoader);
break;
- case IN_ORDER_EXECUTION:
+ case InOrder:
m_pendingInOrderScripts.append(scriptLoader);
m_numberOfInOrderScriptsWithPendingNotification++;
break;
+ case None:
+ 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 Async:
// 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 InOrder:
SECURITY_CHECK(m_numberOfInOrderScriptsWithPendingNotification > 0);
m_numberOfInOrderScriptsWithPendingNotification--;
scheduleReadyInOrderScripts();
break;
+ case None:
+ 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 Async: {
// 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 InOrder:
SECURITY_CHECK(removePendingInOrderScript(scriptLoader));
scheduleReadyInOrderScripts();
break;
+ case None:
+ 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, Async);
m_pendingAsyncScripts.remove(scriptLoader);
m_document->decrementLoadEventDelayCount();
return;
}
if (removePendingInOrderScript(scriptLoader)) {
- newRunner->queueScriptForExecution(scriptLoader, IN_ORDER_EXECUTION);
+ newRunner->queueScriptForExecution(scriptLoader, InOrder);
m_document->decrementLoadEventDelayCount();
}
}
« no previous file with comments | « third_party/WebKit/Source/core/dom/ScriptRunner.h ('k') | third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698