| 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) | 28 #if ENABLE(OILPAN) && ENABLE(ASSERT) | 
| 29     // A prefinalizer has already been registered (as a LifecycleObserver); |  | 
| 30     // remove it and register a combined one, as the infrastructure doesn't |  | 
| 31     // support multiple prefinalizers for an object. |  | 
| 32     // |  | 
| 33     // FIXME: Oilpan: remove LifecycleObserver's need for a prefinalizer, |  | 
| 34     // and as a consequence, this unregistration step. If the former is |  | 
| 35     // independently removed, the unregisterPreFinalizer() call will assert. |  | 
| 36     ThreadState::current()->unregisterPreFinalizer(*static_cast<LifecycleObserve
     r*>(this)); |  | 
| 37     ThreadState::current()->registerPreFinalizer(*this); | 29     ThreadState::current()->registerPreFinalizer(*this); | 
| 38 #endif | 30 #endif | 
| 39 } | 31 } | 
| 40 | 32 | 
| 41 void ScriptPromiseResolver::suspend() | 33 void ScriptPromiseResolver::suspend() | 
| 42 { | 34 { | 
| 43     m_timer.stop(); | 35     m_timer.stop(); | 
| 44 } | 36 } | 
| 45 | 37 | 
| 46 void ScriptPromiseResolver::resume() | 38 void ScriptPromiseResolver::resume() | 
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 108         deref(); | 100         deref(); | 
| 109     } | 101     } | 
| 110 } | 102 } | 
| 111 | 103 | 
| 112 DEFINE_TRACE(ScriptPromiseResolver) | 104 DEFINE_TRACE(ScriptPromiseResolver) | 
| 113 { | 105 { | 
| 114     ActiveDOMObject::trace(visitor); | 106     ActiveDOMObject::trace(visitor); | 
| 115 } | 107 } | 
| 116 | 108 | 
| 117 } // namespace blink | 109 } // namespace blink | 
| OLD | NEW | 
|---|