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