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 99 matching lines...) Loading... |
110 #if ENABLE(ASSERT) | 110 #if ENABLE(ASSERT) |
111 void assertNotPending() | 111 void assertNotPending() |
112 { | 112 { |
113 // This assertion fails if: | 113 // This assertion fails if: |
114 // - promise() is called at least once and | 114 // - promise() is called at least once and |
115 // - this resolver is destructed before it is resolved, rejected or | 115 // - this resolver is destructed before it is resolved, rejected or |
116 // the associated ExecutionContext is stopped. | 116 // the associated ExecutionContext is stopped. |
117 // This function cannot be run in the destructor if | 117 // This function cannot be run in the destructor if |
118 // ScriptPromiseResolver is on-heap. | 118 // ScriptPromiseResolver is on-heap. |
119 ASSERT(m_state == ResolvedOrRejected || !m_isPromiseCalled || !execution
Context() || executionContext()->activeDOMObjectsAreStopped()); | 119 ASSERT(m_state == ResolvedOrRejected || !m_isPromiseCalled || !execution
Context() || executionContext()->activeDOMObjectsAreStopped()); |
120 | |
121 #if ENABLE(OILPAN) | |
122 // Delegate to LifecycleObserver's prefinalizer. | |
123 LifecycleObserver::dispose(); | |
124 #endif | |
125 } | 120 } |
126 #endif | 121 #endif |
127 | 122 |
128 template<typename T> | 123 template<typename T> |
129 void resolveOrReject(T value, ResolutionState newState) | 124 void resolveOrReject(T value, ResolutionState newState) |
130 { | 125 { |
131 if (m_state != Pending || !executionContext() || executionContext()->act
iveDOMObjectsAreStopped()) | 126 if (m_state != Pending || !executionContext() || executionContext()->act
iveDOMObjectsAreStopped()) |
132 return; | 127 return; |
133 ASSERT(newState == Resolving || newState == Rejecting); | 128 ASSERT(newState == Resolving || newState == Rejecting); |
134 m_state = newState; | 129 m_state = newState; |
(...skipping 21 matching lines...) Loading... |
156 ScopedPersistent<v8::Value> m_value; | 151 ScopedPersistent<v8::Value> m_value; |
157 #if ENABLE(ASSERT) | 152 #if ENABLE(ASSERT) |
158 // True if promise() is called. | 153 // True if promise() is called. |
159 bool m_isPromiseCalled; | 154 bool m_isPromiseCalled; |
160 #endif | 155 #endif |
161 }; | 156 }; |
162 | 157 |
163 } // namespace blink | 158 } // namespace blink |
164 | 159 |
165 #endif // ScriptPromiseResolver_h | 160 #endif // ScriptPromiseResolver_h |
OLD | NEW |