| 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 #ifndef ScriptPromiseResolver_h | 5 #ifndef ScriptPromiseResolver_h |
| 6 #define ScriptPromiseResolver_h | 6 #define ScriptPromiseResolver_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScopedPersistent.h" | 8 #include "bindings/core/v8/ScopedPersistent.h" |
| 9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
| 10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 void resolve() { resolve(V8UndefinedType()); } | 63 void resolve() { resolve(V8UndefinedType()); } |
| 64 void reject() { reject(V8UndefinedType()); } | 64 void reject() { reject(V8UndefinedType()); } |
| 65 | 65 |
| 66 ScriptState* scriptState() { return m_scriptState.get(); } | 66 ScriptState* scriptState() { return m_scriptState.get(); } |
| 67 | 67 |
| 68 // Note that an empty ScriptPromise will be returned after resolve or | 68 // Note that an empty ScriptPromise will be returned after resolve or |
| 69 // reject is called. | 69 // reject is called. |
| 70 ScriptPromise promise() | 70 ScriptPromise promise() |
| 71 { | 71 { |
| 72 #if ASSERT_ENABLED | 72 #if ENABLE(ASSERT) |
| 73 m_isPromiseCalled = true; | 73 m_isPromiseCalled = true; |
| 74 #endif | 74 #endif |
| 75 return m_resolver.promise(); | 75 return m_resolver.promise(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 ScriptState* scriptState() const { return m_scriptState.get(); } | 78 ScriptState* scriptState() const { return m_scriptState.get(); } |
| 79 | 79 |
| 80 // ActiveDOMObject implementation. | 80 // ActiveDOMObject implementation. |
| 81 virtual void suspend() OVERRIDE; | 81 virtual void suspend() OVERRIDE; |
| 82 virtual void resume() OVERRIDE; | 82 virtual void resume() OVERRIDE; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 void resolveOrRejectImmediately(); | 130 void resolveOrRejectImmediately(); |
| 131 void onTimerFired(Timer<ScriptPromiseResolver>*); | 131 void onTimerFired(Timer<ScriptPromiseResolver>*); |
| 132 void clear(); | 132 void clear(); |
| 133 | 133 |
| 134 ResolutionState m_state; | 134 ResolutionState m_state; |
| 135 const RefPtr<ScriptState> m_scriptState; | 135 const RefPtr<ScriptState> m_scriptState; |
| 136 LifetimeMode m_mode; | 136 LifetimeMode m_mode; |
| 137 Timer<ScriptPromiseResolver> m_timer; | 137 Timer<ScriptPromiseResolver> m_timer; |
| 138 Resolver m_resolver; | 138 Resolver m_resolver; |
| 139 ScopedPersistent<v8::Value> m_value; | 139 ScopedPersistent<v8::Value> m_value; |
| 140 #if ASSERT_ENABLED | 140 #if ENABLE(ASSERT) |
| 141 // True if promise() is called. | 141 // True if promise() is called. |
| 142 bool m_isPromiseCalled; | 142 bool m_isPromiseCalled; |
| 143 #endif | 143 #endif |
| 144 }; | 144 }; |
| 145 | 145 |
| 146 } // namespace WebCore | 146 } // namespace WebCore |
| 147 | 147 |
| 148 #endif // #ifndef ScriptPromiseResolver_h | 148 #endif // #ifndef ScriptPromiseResolver_h |
| OLD | NEW |