| 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 "bindings/core/v8/ScriptPromiseResolver.h" | 6 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/V8RecursionScope.h" | 8 #include "bindings/core/v8/V8RecursionScope.h" |
| 9 #include "platform/LifecycleObserver.h" | 9 #include "platform/LifecycleObserver.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 ScriptPromiseResolver::ScriptPromiseResolver(ScriptState* scriptState) | 13 ScriptPromiseResolver::ScriptPromiseResolver(ScriptState* scriptState) |
| 14 : ActiveDOMObject(scriptState->executionContext()) | 14 : ActiveDOMObject(scriptState->executionContext()) |
| 15 , m_state(Pending) | 15 , m_state(Pending) |
| 16 , m_scriptState(scriptState) | 16 , m_scriptState(scriptState) |
| 17 , m_mode(Default) | 17 , m_mode(Default) |
| 18 , m_timer(this, &ScriptPromiseResolver::onTimerFired) | 18 , m_timer(this, &ScriptPromiseResolver::onTimerFired) |
| 19 , m_resolver(scriptState) | 19 , m_resolver(scriptState) |
| 20 #if ENABLE(ASSERT) | 20 #if ENABLE(ASSERT) |
| 21 , m_isPromiseCalled(false) | 21 , m_isPromiseCalled(false) |
| 22 #endif | 22 #endif |
| 23 { | 23 { |
| 24 if (executionContext()->activeDOMObjectsAreStopped()) { | 24 if (executionContext()->activeDOMObjectsAreStopped()) { |
| 25 m_state = ResolvedOrRejected; | 25 m_state = ResolvedOrRejected; |
| 26 m_resolver.clear(); | 26 m_resolver.clear(); |
| 27 } | 27 } |
| 28 #if ENABLE(OILPAN) && ENABLE(ASSERT) | |
| 29 ThreadState::current()->registerPreFinalizer(*this); | |
| 30 #endif | |
| 31 } | 28 } |
| 32 | 29 |
| 33 void ScriptPromiseResolver::suspend() | 30 void ScriptPromiseResolver::suspend() |
| 34 { | 31 { |
| 35 m_timer.stop(); | 32 m_timer.stop(); |
| 36 } | 33 } |
| 37 | 34 |
| 38 void ScriptPromiseResolver::resume() | 35 void ScriptPromiseResolver::resume() |
| 39 { | 36 { |
| 40 if (m_state == Resolving || m_state == Rejecting) | 37 if (m_state == Resolving || m_state == Rejecting) |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 deref(); | 97 deref(); |
| 101 } | 98 } |
| 102 } | 99 } |
| 103 | 100 |
| 104 DEFINE_TRACE(ScriptPromiseResolver) | 101 DEFINE_TRACE(ScriptPromiseResolver) |
| 105 { | 102 { |
| 106 ActiveDOMObject::trace(visitor); | 103 ActiveDOMObject::trace(visitor); |
| 107 } | 104 } |
| 108 | 105 |
| 109 } // namespace blink | 106 } // namespace blink |
| OLD | NEW |