Chromium Code Reviews| Index: Source/core/dom/ScriptRunner.cpp |
| diff --git a/Source/core/dom/ScriptRunner.cpp b/Source/core/dom/ScriptRunner.cpp |
| index d33ea6ee52dedd7a55b82d1fd94e0ef3c94c0a5a..21798469eedb029b4f465b6350c647f54678508e 100644 |
| --- a/Source/core/dom/ScriptRunner.cpp |
| +++ b/Source/core/dom/ScriptRunner.cpp |
| @@ -31,6 +31,7 @@ |
| #include "core/dom/PendingScript.h" |
| #include "core/dom/ScriptLoader.h" |
| #include "core/fetch/ScriptResource.h" |
| +#include "platform/heap/Handle.h" |
| namespace WebCore { |
| @@ -43,12 +44,6 @@ ScriptRunner::ScriptRunner(Document* document) |
| ScriptRunner::~ScriptRunner() |
| { |
| - for (size_t i = 0; i < m_scriptsToExecuteSoon.size(); ++i) |
|
eseidel
2014/05/28 22:43:38
Wow this code is scary.
|
| - m_document->decrementLoadEventDelayCount(); |
| - for (size_t i = 0; i < m_scriptsToExecuteInOrder.size(); ++i) |
| - m_document->decrementLoadEventDelayCount(); |
| - for (size_t i = 0; i < m_pendingAsyncScripts.size(); ++i) |
| - m_document->decrementLoadEventDelayCount(); |
|
haraken
2014/05/29 01:46:08
Just help me understand: I agree that we no longer
sof
2014/05/29 06:02:07
For the same reason, essentially. The ScriptRunner
|
| } |
| void ScriptRunner::queueScriptForExecution(ScriptLoader* scriptLoader, ResourcePtr<ScriptResource> resource, ExecutionType executionType) |
| @@ -118,7 +113,7 @@ void ScriptRunner::timerFired(Timer<ScriptRunner>* timer) |
| { |
| ASSERT_UNUSED(timer, timer == &m_timer); |
| - RefPtr<Document> protect(m_document); |
| + RefPtrWillBeRawPtr<Document> protect(m_document.get()); |
| Vector<PendingScript> scripts; |
| scripts.swap(m_scriptsToExecuteSoon); |
| @@ -132,10 +127,18 @@ void ScriptRunner::timerFired(Timer<ScriptRunner>* timer) |
| size_t size = scripts.size(); |
| for (size_t i = 0; i < size; ++i) { |
| ScriptResource* resource = scripts[i].resource(); |
| - RefPtr<Element> element = scripts[i].releaseElementAndClear(); |
| + RefPtrWillBeRawPtr<Element> element = scripts[i].releaseElementAndClear(); |
| toScriptLoaderIfPossible(element.get())->execute(resource); |
| m_document->decrementLoadEventDelayCount(); |
| } |
| } |
| +void ScriptRunner::trace(Visitor* visitor) |
| +{ |
| + visitor->trace(m_document); |
| + visitor->trace(m_scriptsToExecuteInOrder); |
| + visitor->trace(m_scriptsToExecuteSoon); |
| + visitor->trace(m_pendingAsyncScripts); |
| +} |
| + |
| } |