| 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 13 matching lines...) Expand all Loading... |
| 24 // - This class is an ActiveDOMObject and keeps track of the associated | 24 // - This class is an ActiveDOMObject and keeps track of the associated |
| 25 // ExecutionContext state. When the ExecutionContext is suspended, | 25 // ExecutionContext state. When the ExecutionContext is suspended, |
| 26 // resolve or reject will be delayed. When it is stopped, resolve or reject | 26 // resolve or reject will be delayed. When it is stopped, resolve or reject |
| 27 // will be ignored. | 27 // will be ignored. |
| 28 class ScriptPromiseResolver : public ActiveDOMObject, public RefCounted<ScriptPr
omiseResolver> { | 28 class ScriptPromiseResolver : public ActiveDOMObject, public RefCounted<ScriptPr
omiseResolver> { |
| 29 WTF_MAKE_NONCOPYABLE(ScriptPromiseResolver); | 29 WTF_MAKE_NONCOPYABLE(ScriptPromiseResolver); |
| 30 | 30 |
| 31 public: | 31 public: |
| 32 static PassRefPtr<ScriptPromiseResolver> create(ScriptState* scriptState) | 32 static PassRefPtr<ScriptPromiseResolver> create(ScriptState* scriptState) |
| 33 { | 33 { |
| 34 fprintf(stderr, "ScriptPromiseResolver::create()\n"); |
| 34 RefPtr<ScriptPromiseResolver> resolver = adoptRef(new ScriptPromiseResol
ver(scriptState)); | 35 RefPtr<ScriptPromiseResolver> resolver = adoptRef(new ScriptPromiseResol
ver(scriptState)); |
| 36 fprintf(stderr, "ScriptPromiseResolver::create() 2\n"); |
| 35 resolver->suspendIfNeeded(); | 37 resolver->suspendIfNeeded(); |
| 38 fprintf(stderr, "ScriptPromiseResolver::create() 3\n"); |
| 36 return resolver.release(); | 39 return resolver.release(); |
| 37 } | 40 } |
| 38 | 41 |
| 39 virtual ~ScriptPromiseResolver() | 42 virtual ~ScriptPromiseResolver() |
| 40 { | 43 { |
| 41 // This assertion fails if: | 44 // This assertion fails if: |
| 42 // - promise() is called at least once and | 45 // - promise() is called at least once and |
| 43 // - this resolver is destructed before it is resolved, rejected or | 46 // - this resolver is destructed before it is resolved, rejected or |
| 44 // the associated ExecutionContext is stopped. | 47 // the associated ExecutionContext is stopped. |
| 45 ASSERT(m_state == ResolvedOrRejected || !m_isPromiseCalled); | 48 ASSERT(m_state == ResolvedOrRejected || !m_isPromiseCalled); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 ScopedPersistent<v8::Value> m_value; | 141 ScopedPersistent<v8::Value> m_value; |
| 139 #if ENABLE(ASSERT) | 142 #if ENABLE(ASSERT) |
| 140 // True if promise() is called. | 143 // True if promise() is called. |
| 141 bool m_isPromiseCalled; | 144 bool m_isPromiseCalled; |
| 142 #endif | 145 #endif |
| 143 }; | 146 }; |
| 144 | 147 |
| 145 } // namespace blink | 148 } // namespace blink |
| 146 | 149 |
| 147 #endif // #ifndef ScriptPromiseResolver_h | 150 #endif // #ifndef ScriptPromiseResolver_h |
| OLD | NEW |