| 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/dom/TaskRunnerHelper.h" | 7 #include "core/dom/TaskRunnerHelper.h" |
| 8 #include "core/inspector/InspectorInstrumentation.h" | 8 #include "core/inspector/InspectorInstrumentation.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 ScriptPromiseResolver::ScriptPromiseResolver(ScriptState* scriptState) | 12 ScriptPromiseResolver::ScriptPromiseResolver(ScriptState* scriptState) |
| 13 : SuspendableObject(scriptState->getExecutionContext()), | 13 : SuspendableObject(scriptState->getExecutionContext()), |
| 14 m_state(Pending), | 14 m_state(Pending), |
| 15 m_scriptState(scriptState), | 15 m_scriptState(scriptState), |
| 16 m_timer(TaskRunnerHelper::get(TaskType::Microtask, getExecutionContext()), | 16 m_timer(TaskRunnerHelper::get(TaskType::Microtask, getExecutionContext()), |
| 17 this, | 17 this, |
| 18 &ScriptPromiseResolver::onTimerFired), | 18 &ScriptPromiseResolver::onTimerFired), |
| 19 m_resolver(scriptState) | 19 m_resolver(scriptState) |
| 20 #if ENABLE(ASSERT) | |
| 21 , | |
| 22 m_isPromiseCalled(false) | |
| 23 #endif | |
| 24 { | 20 { |
| 25 if (getExecutionContext()->isContextDestroyed()) { | 21 if (getExecutionContext()->isContextDestroyed()) { |
| 26 m_state = Detached; | 22 m_state = Detached; |
| 27 m_resolver.clear(); | 23 m_resolver.clear(); |
| 28 } | 24 } |
| 29 InspectorInstrumentation::asyncTaskScheduled(getExecutionContext(), "Promise", | 25 InspectorInstrumentation::asyncTaskScheduled(getExecutionContext(), "Promise", |
| 30 this); | 26 this); |
| 31 } | 27 } |
| 32 | 28 |
| 33 void ScriptPromiseResolver::suspend() { | 29 void ScriptPromiseResolver::suspend() { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 82 } |
| 87 } | 83 } |
| 88 detach(); | 84 detach(); |
| 89 } | 85 } |
| 90 | 86 |
| 91 DEFINE_TRACE(ScriptPromiseResolver) { | 87 DEFINE_TRACE(ScriptPromiseResolver) { |
| 92 SuspendableObject::trace(visitor); | 88 SuspendableObject::trace(visitor); |
| 93 } | 89 } |
| 94 | 90 |
| 95 } // namespace blink | 91 } // namespace blink |
| OLD | NEW |