| 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 "bindings/core/v8/ScriptPromiseResolver.h" | 5 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 6 | 6 |
| 7 #include "core/inspector/InspectorInstrumentation.h" | 7 #include "core/inspector/InspectorInstrumentation.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| 11 ScriptPromiseResolver::ScriptPromiseResolver(ScriptState* scriptState) | 11 ScriptPromiseResolver::ScriptPromiseResolver(ScriptState* scriptState) |
| 12 : ActiveDOMObject(scriptState->getExecutionContext()), | 12 : ActiveDOMObject(scriptState->getExecutionContext()), |
| 13 m_state(Pending), | 13 m_state(Pending), |
| 14 m_scriptState(scriptState), | 14 m_scriptState(scriptState), |
| 15 m_timer(this, &ScriptPromiseResolver::onTimerFired), | 15 m_timer(this, &ScriptPromiseResolver::onTimerFired), |
| 16 m_resolver(scriptState) | 16 m_resolver(scriptState) |
| 17 #if ENABLE(ASSERT) | 17 #if ENABLE(ASSERT) |
| 18 , | 18 , |
| 19 m_isPromiseCalled(false) | 19 m_isPromiseCalled(false) |
| 20 #endif | 20 #endif |
| 21 { | 21 { |
| 22 if (getExecutionContext()->activeDOMObjectsAreStopped()) { | |
| 23 m_state = Detached; | |
| 24 m_resolver.clear(); | |
| 25 } | |
| 26 InspectorInstrumentation::asyncTaskScheduled(getExecutionContext(), "Promise", | 22 InspectorInstrumentation::asyncTaskScheduled(getExecutionContext(), "Promise", |
| 27 this); | 23 this); |
| 28 } | 24 } |
| 29 | 25 |
| 30 void ScriptPromiseResolver::suspend() { | 26 void ScriptPromiseResolver::suspend() { |
| 31 m_timer.stop(); | 27 m_timer.stop(); |
| 32 } | 28 } |
| 33 | 29 |
| 34 void ScriptPromiseResolver::resume() { | 30 void ScriptPromiseResolver::resume() { |
| 35 if (m_state == Resolving || m_state == Rejecting) | 31 if (m_state == Resolving || m_state == Rejecting) |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 79 } |
| 84 } | 80 } |
| 85 detach(); | 81 detach(); |
| 86 } | 82 } |
| 87 | 83 |
| 88 DEFINE_TRACE(ScriptPromiseResolver) { | 84 DEFINE_TRACE(ScriptPromiseResolver) { |
| 89 ActiveDOMObject::trace(visitor); | 85 ActiveDOMObject::trace(visitor); |
| 90 } | 86 } |
| 91 | 87 |
| 92 } // namespace blink | 88 } // namespace blink |
| OLD | NEW |