Chromium Code Reviews| Index: Source/web/SuspendableScriptExecutor.cpp |
| diff --git a/Source/web/SuspendableScriptExecutor.cpp b/Source/web/SuspendableScriptExecutor.cpp |
| index 13118aac8071be0c0ce566063326d75baf742a6c..30c23dbaba64d810a433ede10826dbf7d4f3b1de 100644 |
| --- a/Source/web/SuspendableScriptExecutor.cpp |
| +++ b/Source/web/SuspendableScriptExecutor.cpp |
| @@ -22,22 +22,17 @@ void SuspendableScriptExecutor::createAndRun(LocalFrame* frame, int worldID, con |
| executor->run(); |
| } |
| -void SuspendableScriptExecutor::resume() |
| -{ |
| - executeAndDestroySelf(); |
| -} |
| - |
| void SuspendableScriptExecutor::contextDestroyed() |
| { |
| // this method can only be called if the script was not called in run() |
| // and context remained suspend (method resume has never called) |
| - ActiveDOMObject::contextDestroyed(); |
| + SuspendableTimer::contextDestroyed(); |
| m_callback->completed(Vector<v8::Local<v8::Value>>()); |
| deref(); |
| } |
| SuspendableScriptExecutor::SuspendableScriptExecutor(LocalFrame* frame, int worldID, const WillBeHeapVector<ScriptSourceCode>& sources, int extensionGroup, bool userGesture, WebScriptExecutionCallback* callback) |
| - : ActiveDOMObject(frame->document()) |
| + : SuspendableTimer(frame->document()) |
| , m_frame(frame) |
| , m_worldID(worldID) |
| , m_sources(sources) |
| @@ -51,13 +46,22 @@ SuspendableScriptExecutor::~SuspendableScriptExecutor() |
| { |
| } |
| +void SuspendableScriptExecutor::fired() |
| +{ |
| + executeAndDestroySelf(); |
| +} |
| + |
| void SuspendableScriptExecutor::run() |
| { |
| - suspendIfNeeded(); |
| ExecutionContext* context = executionContext(); |
| ASSERT(context); |
| - if (context && !context->activeDOMObjectsAreSuspended()) |
| + if (!context->activeDOMObjectsAreSuspended()) { |
| + suspendIfNeeded(); |
|
pfeldman
2015/02/05 13:49:42
Why do you make this call?
kozy
2015/02/05 14:58:26
We can remove it. Removed.
|
| executeAndDestroySelf(); |
| + } else { |
| + startOneShot(0, FROM_HERE); |
| + suspendIfNeeded(); |
| + } |
| } |
| void SuspendableScriptExecutor::executeAndDestroySelf() |
| @@ -86,7 +90,7 @@ void SuspendableScriptExecutor::trace(Visitor* visitor) |
| visitor->trace(m_frame); |
| visitor->trace(m_sources); |
| #endif |
| - ActiveDOMObject::trace(visitor); |
| + SuspendableTimer::trace(visitor); |
| } |
| } // namespace blink |