Index: Source/core/dom/ScriptRunner.cpp |
diff --git a/Source/core/dom/ScriptRunner.cpp b/Source/core/dom/ScriptRunner.cpp |
index 11e99b83b0d954af2f766cc4a11f715d76a002ec..bc1a7a5d9171c6e0f22256a015f296582d954907 100644 |
--- a/Source/core/dom/ScriptRunner.cpp |
+++ b/Source/core/dom/ScriptRunner.cpp |
@@ -46,6 +46,12 @@ ScriptRunner::~ScriptRunner() |
{ |
} |
+void ScriptRunner::addPendingAsyncScript(ScriptLoader* scriptLoader, const PendingScript& pendingScript) |
+{ |
+ m_document->incrementLoadEventDelayCount(); |
+ m_pendingAsyncScripts.add(scriptLoader, pendingScript); |
+} |
+ |
void ScriptRunner::queueScriptForExecution(ScriptLoader* scriptLoader, ResourcePtr<ScriptResource> resource, ExecutionType executionType) |
{ |
ASSERT(scriptLoader); |
@@ -55,14 +61,13 @@ void ScriptRunner::queueScriptForExecution(ScriptLoader* scriptLoader, ResourceP |
ASSERT(element); |
ASSERT(element->inDocument()); |
- m_document->incrementLoadEventDelayCount(); |
- |
switch (executionType) { |
case ASYNC_EXECUTION: |
- m_pendingAsyncScripts.add(scriptLoader, PendingScript(element, resource.get())); |
+ addPendingAsyncScript(scriptLoader, PendingScript(element, resource.get())); |
break; |
case IN_ORDER_EXECUTION: |
+ m_document->incrementLoadEventDelayCount(); |
m_scriptsToExecuteInOrder.append(PendingScript(element, resource.get())); |
break; |
} |
@@ -109,6 +114,14 @@ void ScriptRunner::notifyScriptLoadError(ScriptLoader* scriptLoader, ExecutionTy |
} |
} |
+void ScriptRunner::movePendingAsyncScript(ScriptRunner* newRunner, ScriptLoader* scriptLoader) |
+{ |
+ if (m_pendingAsyncScripts.contains(scriptLoader)) { |
+ newRunner->addPendingAsyncScript(scriptLoader, m_pendingAsyncScripts.take(scriptLoader)); |
+ m_document->decrementLoadEventDelayCount(); |
+ } |
+} |
+ |
void ScriptRunner::timerFired(Timer<ScriptRunner>* timer) |
{ |
ASSERT_UNUSED(timer, timer == &m_timer); |