Chromium Code Reviews| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 | 78 |
| 79 // ActiveDOMObject implementation. | 79 // ActiveDOMObject implementation. |
| 80 virtual void suspend() override; | 80 virtual void suspend() override; |
| 81 virtual void resume() override; | 81 virtual void resume() override; |
| 82 virtual void stop() override; | 82 virtual void stop() override; |
| 83 | 83 |
| 84 // Once this function is called this resolver stays alive while the | 84 // Once this function is called this resolver stays alive while the |
| 85 // promise is pending and the associated ExecutionContext isn't stopped. | 85 // promise is pending and the associated ExecutionContext isn't stopped. |
| 86 void keepAliveWhilePending(); | 86 void keepAliveWhilePending(); |
| 87 | 87 |
| 88 bool stopped() { return m_resolver.cleared(); } | |
|
tasak
2014/12/04 08:08:01
Used for ASSERTION in ~CryptoResultImpl.
| |
| 89 | |
| 88 protected: | 90 protected: |
| 89 // You need to call suspendIfNeeded after the construction because | 91 // You need to call suspendIfNeeded after the construction because |
| 90 // this is an ActiveDOMObject. | 92 // this is an ActiveDOMObject. |
| 91 explicit ScriptPromiseResolver(ScriptState*); | 93 explicit ScriptPromiseResolver(ScriptState*); |
| 92 | 94 |
| 95 protected: | |
| 96 virtual void resolverCleared() { } | |
|
tasak
2014/12/04 08:08:01
Invoked in ScriptPromiseResolver::clear().
| |
| 97 | |
| 93 private: | 98 private: |
| 94 typedef ScriptPromise::InternalResolver Resolver; | 99 typedef ScriptPromise::InternalResolver Resolver; |
| 95 enum ResolutionState { | 100 enum ResolutionState { |
| 96 Pending, | 101 Pending, |
| 97 Resolving, | 102 Resolving, |
| 98 Rejecting, | 103 Rejecting, |
| 99 ResolvedOrRejected, | 104 ResolvedOrRejected, |
| 100 }; | 105 }; |
| 101 enum LifetimeMode { | 106 enum LifetimeMode { |
| 102 Default, | 107 Default, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 ScopedPersistent<v8::Value> m_value; | 143 ScopedPersistent<v8::Value> m_value; |
| 139 #if ENABLE(ASSERT) | 144 #if ENABLE(ASSERT) |
| 140 // True if promise() is called. | 145 // True if promise() is called. |
| 141 bool m_isPromiseCalled; | 146 bool m_isPromiseCalled; |
| 142 #endif | 147 #endif |
| 143 }; | 148 }; |
| 144 | 149 |
| 145 } // namespace blink | 150 } // namespace blink |
| 146 | 151 |
| 147 #endif // #ifndef ScriptPromiseResolver_h | 152 #endif // #ifndef ScriptPromiseResolver_h |
| OLD | NEW |