| 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 ScriptPromisePropertyBase_h | 5 #ifndef ScriptPromisePropertyBase_h |
| 6 #define ScriptPromisePropertyBase_h | 6 #define ScriptPromisePropertyBase_h |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "bindings/core/v8/ScopedPersistent.h" | 10 #include "bindings/core/v8/ScopedPersistent.h" |
| 11 #include "bindings/core/v8/ScriptPromise.h" | 11 #include "bindings/core/v8/ScriptPromise.h" |
| 12 #include "bindings/core/v8/ScriptPromiseProperties.h" | 12 #include "bindings/core/v8/ScriptPromiseProperties.h" |
| 13 #include "bindings/core/v8/V8PrivateProperty.h" |
| 13 #include "core/CoreExport.h" | 14 #include "core/CoreExport.h" |
| 14 #include "core/dom/ContextLifecycleObserver.h" | 15 #include "core/dom/ContextLifecycleObserver.h" |
| 15 #include "v8/include/v8.h" | 16 #include "v8/include/v8.h" |
| 16 #include "wtf/Compiler.h" | 17 #include "wtf/Compiler.h" |
| 17 #include "wtf/RefCounted.h" | 18 #include "wtf/RefCounted.h" |
| 18 #include "wtf/Vector.h" | 19 #include "wtf/Vector.h" |
| 19 | 20 |
| 20 namespace blink { | 21 namespace blink { |
| 21 | 22 |
| 22 class DOMWrapperWorld; | 23 class DOMWrapperWorld; |
| 23 class ExecutionContext; | 24 class ExecutionContext; |
| 24 class ScriptState; | 25 class ScriptState; |
| 25 | 26 |
| 26 // TODO(yhirano): Remove NEVER_INLINE once we find the cause of crashes. | 27 // TODO(yhirano): Remove NEVER_INLINE once we find the cause of crashes. |
| 27 class CORE_EXPORT ScriptPromisePropertyBase | 28 class CORE_EXPORT ScriptPromisePropertyBase |
| 28 : public GarbageCollectedFinalized<ScriptPromisePropertyBase>, | 29 : public GarbageCollectedFinalized<ScriptPromisePropertyBase>, |
| 29 public ContextClient { | 30 public ContextClient { |
| 30 USING_GARBAGE_COLLECTED_MIXIN(ScriptPromisePropertyBase); | 31 USING_GARBAGE_COLLECTED_MIXIN(ScriptPromisePropertyBase); |
| 31 | 32 |
| 32 public: | 33 public: |
| 33 virtual ~ScriptPromisePropertyBase(); | 34 virtual ~ScriptPromisePropertyBase(); |
| 34 | 35 |
| 35 enum Name { | 36 enum Name { |
| 36 #define P(Name) Name, | 37 #define P(Unused, Name) Name, |
| 37 SCRIPT_PROMISE_PROPERTIES(P) | 38 SCRIPT_PROMISE_PROPERTIES(P) |
| 38 #undef P | 39 #undef P |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 enum State { | 42 enum State { |
| 42 Pending, | 43 Pending, |
| 43 Resolved, | 44 Resolved, |
| 44 Rejected, | 45 Rejected, |
| 45 }; | 46 }; |
| 46 State getState() const { return m_state; } | 47 State getState() const { return m_state; } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 76 typedef Vector<std::unique_ptr<ScopedPersistent<v8::Object>>> | 77 typedef Vector<std::unique_ptr<ScopedPersistent<v8::Object>>> |
| 77 WeakPersistentSet; | 78 WeakPersistentSet; |
| 78 | 79 |
| 79 void resolveOrRejectInternal(v8::Local<v8::Promise::Resolver>); | 80 void resolveOrRejectInternal(v8::Local<v8::Promise::Resolver>); |
| 80 v8::Local<v8::Object> ensureHolderWrapper(ScriptState*); | 81 v8::Local<v8::Object> ensureHolderWrapper(ScriptState*); |
| 81 NEVER_INLINE void clearWrappers(); | 82 NEVER_INLINE void clearWrappers(); |
| 82 // TODO(yhirano): Remove these functions once we find the cause of crashes. | 83 // TODO(yhirano): Remove these functions once we find the cause of crashes. |
| 83 NEVER_INLINE void checkThis(); | 84 NEVER_INLINE void checkThis(); |
| 84 NEVER_INLINE void checkWrappers(); | 85 NEVER_INLINE void checkWrappers(); |
| 85 | 86 |
| 86 v8::Local<v8::String> promiseName(); | 87 V8PrivateProperty::Symbol promiseSymbol(); |
| 87 v8::Local<v8::String> resolverName(); | 88 V8PrivateProperty::Symbol resolverSymbol(); |
| 88 | 89 |
| 89 v8::Isolate* m_isolate; | 90 v8::Isolate* m_isolate; |
| 90 Name m_name; | 91 Name m_name; |
| 91 State m_state; | 92 State m_state; |
| 92 | 93 |
| 93 WeakPersistentSet m_wrappers; | 94 WeakPersistentSet m_wrappers; |
| 94 }; | 95 }; |
| 95 | 96 |
| 96 } // namespace blink | 97 } // namespace blink |
| 97 | 98 |
| 98 #endif // ScriptPromisePropertyBase_h | 99 #endif // ScriptPromisePropertyBase_h |
| OLD | NEW |