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 ScriptPromiseProperty_h | 5 #ifndef ScriptPromiseProperty_h |
6 #define ScriptPromiseProperty_h | 6 #define ScriptPromiseProperty_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "bindings/core/v8/ScriptPromisePropertyBase.h" | 9 #include "bindings/core/v8/ScriptPromisePropertyBase.h" |
10 #include "bindings/core/v8/ToV8.h" | 10 #include "bindings/core/v8/ToV8.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 // Resets this property by unregistering the Promise property from the | 65 // Resets this property by unregistering the Promise property from the |
66 // holder wrapper. Resets the internal state to Pending and clears the | 66 // holder wrapper. Resets the internal state to Pending and clears the |
67 // resolved and the rejected values. | 67 // resolved and the rejected values. |
68 // This method keeps the holder object and the property name. | 68 // This method keeps the holder object and the property name. |
69 void reset(); | 69 void reset(); |
70 | 70 |
71 DECLARE_VIRTUAL_TRACE(); | 71 DECLARE_VIRTUAL_TRACE(); |
72 | 72 |
73 private: | 73 private: |
74 virtual v8::Handle<v8::Object> holder(v8::Handle<v8::Object> creationContext
, v8::Isolate*) override; | 74 virtual v8::Handle<v8::Object> holder(v8::Isolate*, v8::Handle<v8::Object> c
reationContext) override; |
75 virtual v8::Handle<v8::Value> resolvedValue(v8::Isolate*, v8::Handle<v8::Obj
ect> creationContext) override; | 75 virtual v8::Handle<v8::Value> resolvedValue(v8::Isolate*, v8::Handle<v8::Obj
ect> creationContext) override; |
76 virtual v8::Handle<v8::Value> rejectedValue(v8::Isolate*, v8::Handle<v8::Obj
ect> creationContext) override; | 76 virtual v8::Handle<v8::Value> rejectedValue(v8::Isolate*, v8::Handle<v8::Obj
ect> creationContext) override; |
77 | 77 |
78 HolderType m_holder; | 78 HolderType m_holder; |
79 ResolvedType m_resolved; | 79 ResolvedType m_resolved; |
80 RejectedType m_rejected; | 80 RejectedType m_rejected; |
81 }; | 81 }; |
82 | 82 |
83 template<typename HolderType, typename ResolvedType, typename RejectedType> | 83 template<typename HolderType, typename ResolvedType, typename RejectedType> |
84 template<typename PassHolderType> | 84 template<typename PassHolderType> |
(...skipping 25 matching lines...) Expand all Loading... |
110 ASSERT_NOT_REACHED(); | 110 ASSERT_NOT_REACHED(); |
111 return; | 111 return; |
112 } | 112 } |
113 if (!executionContext() || executionContext()->activeDOMObjectsAreStopped()) | 113 if (!executionContext() || executionContext()->activeDOMObjectsAreStopped()) |
114 return; | 114 return; |
115 m_rejected = value; | 115 m_rejected = value; |
116 resolveOrReject(Rejected); | 116 resolveOrReject(Rejected); |
117 } | 117 } |
118 | 118 |
119 template<typename HolderType, typename ResolvedType, typename RejectedType> | 119 template<typename HolderType, typename ResolvedType, typename RejectedType> |
120 v8::Handle<v8::Object> ScriptPromiseProperty<HolderType, ResolvedType, RejectedT
ype>::holder(v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 120 v8::Handle<v8::Object> ScriptPromiseProperty<HolderType, ResolvedType, RejectedT
ype>::holder(v8::Isolate* isolate, v8::Handle<v8::Object> creationContext) |
121 { | 121 { |
122 v8::Handle<v8::Value> value = toV8(m_holder, creationContext, isolate); | 122 v8::Handle<v8::Value> value = toV8(m_holder, creationContext, isolate); |
123 return value.As<v8::Object>(); | 123 return value.As<v8::Object>(); |
124 } | 124 } |
125 | 125 |
126 template<typename HolderType, typename ResolvedType, typename RejectedType> | 126 template<typename HolderType, typename ResolvedType, typename RejectedType> |
127 v8::Handle<v8::Value> ScriptPromiseProperty<HolderType, ResolvedType, RejectedTy
pe>::resolvedValue(v8::Isolate* isolate, v8::Handle<v8::Object> creationContext) | 127 v8::Handle<v8::Value> ScriptPromiseProperty<HolderType, ResolvedType, RejectedTy
pe>::resolvedValue(v8::Isolate* isolate, v8::Handle<v8::Object> creationContext) |
128 { | 128 { |
129 ASSERT(state() == Resolved); | 129 ASSERT(state() == Resolved); |
130 return toV8(m_resolved, creationContext, isolate); | 130 return toV8(m_resolved, creationContext, isolate); |
(...skipping 25 matching lines...) Expand all Loading... |
156 { | 156 { |
157 TraceIfNeeded<HolderType>::trace(visitor, &m_holder); | 157 TraceIfNeeded<HolderType>::trace(visitor, &m_holder); |
158 TraceIfNeeded<ResolvedType>::trace(visitor, &m_resolved); | 158 TraceIfNeeded<ResolvedType>::trace(visitor, &m_resolved); |
159 TraceIfNeeded<RejectedType>::trace(visitor, &m_rejected); | 159 TraceIfNeeded<RejectedType>::trace(visitor, &m_rejected); |
160 ScriptPromisePropertyBase::trace(visitor); | 160 ScriptPromisePropertyBase::trace(visitor); |
161 } | 161 } |
162 | 162 |
163 } // namespace blink | 163 } // namespace blink |
164 | 164 |
165 #endif // ScriptPromiseProperty_h | 165 #endif // ScriptPromiseProperty_h |
OLD | NEW |