| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "web/SuspendableScriptExecutor.h" | 6 #include "web/SuspendableScriptExecutor.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptController.h" | 8 #include "bindings/core/v8/ScriptController.h" |
| 9 #include "bindings/core/v8/ScriptSourceCode.h" | 9 #include "bindings/core/v8/ScriptSourceCode.h" |
| 10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 void SuspendableScriptExecutor::run() | 52 void SuspendableScriptExecutor::run() |
| 53 { | 53 { |
| 54 ExecutionContext* context = executionContext(); | 54 ExecutionContext* context = executionContext(); |
| 55 ASSERT(context); | 55 ASSERT(context); |
| 56 if (!context->activeDOMObjectsAreSuspended()) { | 56 if (!context->activeDOMObjectsAreSuspended()) { |
| 57 suspendIfNeeded(); | 57 suspendIfNeeded(); |
| 58 executeAndDestroySelf(); | 58 executeAndDestroySelf(); |
| 59 return; | 59 return; |
| 60 } | 60 } |
| 61 startOneShot(0, FROM_HERE); | 61 startOneShot(0, BLINK_FROM_HERE); |
| 62 suspendIfNeeded(); | 62 suspendIfNeeded(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void SuspendableScriptExecutor::executeAndDestroySelf() | 65 void SuspendableScriptExecutor::executeAndDestroySelf() |
| 66 { | 66 { |
| 67 // after calling the destructor of object - object will be unsubscribed from | 67 // after calling the destructor of object - object will be unsubscribed from |
| 68 // resumed and contextDestroyed LifecycleObserver methods | 68 // resumed and contextDestroyed LifecycleObserver methods |
| 69 OwnPtr<UserGestureIndicator> indicator; | 69 OwnPtr<UserGestureIndicator> indicator; |
| 70 if (m_userGesture) | 70 if (m_userGesture) |
| 71 indicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingNewUse
rGesture)); | 71 indicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingNewUse
rGesture)); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 97 } | 97 } |
| 98 | 98 |
| 99 DEFINE_TRACE(SuspendableScriptExecutor) | 99 DEFINE_TRACE(SuspendableScriptExecutor) |
| 100 { | 100 { |
| 101 visitor->trace(m_frame); | 101 visitor->trace(m_frame); |
| 102 visitor->trace(m_sources); | 102 visitor->trace(m_sources); |
| 103 SuspendableTimer::trace(visitor); | 103 SuspendableTimer::trace(visitor); |
| 104 } | 104 } |
| 105 | 105 |
| 106 } // namespace blink | 106 } // namespace blink |
| OLD | NEW |