| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 m_isPromiseCalled = true; | 81 m_isPromiseCalled = true; |
| 82 #endif | 82 #endif |
| 83 return m_resolver.promise(); | 83 return m_resolver.promise(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 ScriptState* getScriptState() const { return m_scriptState.get(); } | 86 ScriptState* getScriptState() const { return m_scriptState.get(); } |
| 87 | 87 |
| 88 // ActiveDOMObject implementation. | 88 // ActiveDOMObject implementation. |
| 89 void suspend() override; | 89 void suspend() override; |
| 90 void resume() override; | 90 void resume() override; |
| 91 void stop() override { detach(); } | 91 void contextDestroyed() override { detach(); } |
| 92 | 92 |
| 93 // Calling this function makes the resolver release its internal resources. | 93 // Calling this function makes the resolver release its internal resources. |
| 94 // That means the associated promise will never be resolved or rejected | 94 // That means the associated promise will never be resolved or rejected |
| 95 // unless it's already been resolved or rejected. | 95 // unless it's already been resolved or rejected. |
| 96 // Do not call this function unless you truly need the behavior. | 96 // Do not call this function unless you truly need the behavior. |
| 97 void detach(); | 97 void detach(); |
| 98 | 98 |
| 99 // Once this function is called this resolver stays alive while the | 99 // Once this function is called this resolver stays alive while the |
| 100 // promise is pending and the associated ExecutionContext isn't stopped. | 100 // promise is pending and the associated ExecutionContext isn't stopped. |
| 101 void keepAliveWhilePending(); | 101 void keepAliveWhilePending(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 #if ENABLE(ASSERT) | 154 #if ENABLE(ASSERT) |
| 155 // True if promise() is called. | 155 // True if promise() is called. |
| 156 bool m_isPromiseCalled; | 156 bool m_isPromiseCalled; |
| 157 #endif | 157 #endif |
| 158 }; | 158 }; |
| 159 | 159 |
| 160 } // namespace blink | 160 } // namespace blink |
| 161 | 161 |
| 162 #endif // ScriptPromiseResolver_h | 162 #endif // ScriptPromiseResolver_h |
| OLD | NEW |