| 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 #include "config.h" | 5 #include "config.h" |
| 6 #include "bindings/core/v8/ScriptPromisePropertyBase.h" | 6 #include "bindings/core/v8/ScriptPromisePropertyBase.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScopedPersistent.h" | 8 #include "bindings/core/v8/ScopedPersistent.h" |
| 9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
| 10 #include "bindings/core/v8/V8Binding.h" | 10 #include "bindings/core/v8/V8Binding.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 ++i; | 100 ++i; |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 | 103 |
| 104 void ScriptPromisePropertyBase::resetBase() | 104 void ScriptPromisePropertyBase::resetBase() |
| 105 { | 105 { |
| 106 clearWrappers(); | 106 clearWrappers(); |
| 107 m_state = Pending; | 107 m_state = Pending; |
| 108 } | 108 } |
| 109 | 109 |
| 110 void ScriptPromisePropertyBase::resolveOrRejectInternal(v8::Handle<v8::Promise::
Resolver> resolver) | 110 void ScriptPromisePropertyBase::resolveOrRejectInternal(v8::Local<v8::Promise::R
esolver> resolver) |
| 111 { | 111 { |
| 112 v8::Local<v8::Context> context = resolver->CreationContext(); | 112 v8::Local<v8::Context> context = resolver->CreationContext(); |
| 113 switch (m_state) { | 113 switch (m_state) { |
| 114 case Pending: | 114 case Pending: |
| 115 ASSERT_NOT_REACHED(); | 115 ASSERT_NOT_REACHED(); |
| 116 break; | 116 break; |
| 117 case Resolved: | 117 case Resolved: |
| 118 resolver->Resolve(context, resolvedValue(m_isolate, context->Global())); | 118 resolver->Resolve(context, resolvedValue(m_isolate, context->Global())); |
| 119 break; | 119 break; |
| 120 case Rejected: | 120 case Rejected: |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 for (WeakPersistentSet::iterator i = m_wrappers.begin(); i != m_wrappers.end
(); ++i) { | 156 for (WeakPersistentSet::iterator i = m_wrappers.begin(); i != m_wrappers.end
(); ++i) { |
| 157 v8::Local<v8::Object> wrapper = (*i)->newLocal(m_isolate); | 157 v8::Local<v8::Object> wrapper = (*i)->newLocal(m_isolate); |
| 158 if (!wrapper.IsEmpty()) { | 158 if (!wrapper.IsEmpty()) { |
| 159 wrapper->DeleteHiddenValue(resolverName()); | 159 wrapper->DeleteHiddenValue(resolverName()); |
| 160 wrapper->DeleteHiddenValue(promiseName()); | 160 wrapper->DeleteHiddenValue(promiseName()); |
| 161 } | 161 } |
| 162 } | 162 } |
| 163 m_wrappers.clear(); | 163 m_wrappers.clear(); |
| 164 } | 164 } |
| 165 | 165 |
| 166 v8::Handle<v8::String> ScriptPromisePropertyBase::promiseName() | 166 v8::Local<v8::String> ScriptPromisePropertyBase::promiseName() |
| 167 { | 167 { |
| 168 switch (m_name) { | 168 switch (m_name) { |
| 169 #define P(Name) \ | 169 #define P(Name) \ |
| 170 case Name: \ | 170 case Name: \ |
| 171 return V8HiddenValue::Name ## Promise(m_isolate); | 171 return V8HiddenValue::Name ## Promise(m_isolate); |
| 172 | 172 |
| 173 SCRIPT_PROMISE_PROPERTIES(P) | 173 SCRIPT_PROMISE_PROPERTIES(P) |
| 174 | 174 |
| 175 #undef P | 175 #undef P |
| 176 } | 176 } |
| 177 ASSERT_NOT_REACHED(); | 177 ASSERT_NOT_REACHED(); |
| 178 return v8::Handle<v8::String>(); | 178 return v8::Local<v8::String>(); |
| 179 } | 179 } |
| 180 | 180 |
| 181 v8::Handle<v8::String> ScriptPromisePropertyBase::resolverName() | 181 v8::Local<v8::String> ScriptPromisePropertyBase::resolverName() |
| 182 { | 182 { |
| 183 switch (m_name) { | 183 switch (m_name) { |
| 184 #define P(Name) \ | 184 #define P(Name) \ |
| 185 case Name: \ | 185 case Name: \ |
| 186 return V8HiddenValue::Name ## Resolver(m_isolate); | 186 return V8HiddenValue::Name ## Resolver(m_isolate); |
| 187 | 187 |
| 188 SCRIPT_PROMISE_PROPERTIES(P) | 188 SCRIPT_PROMISE_PROPERTIES(P) |
| 189 | 189 |
| 190 #undef P | 190 #undef P |
| 191 } | 191 } |
| 192 ASSERT_NOT_REACHED(); | 192 ASSERT_NOT_REACHED(); |
| 193 return v8::Handle<v8::String>(); | 193 return v8::Local<v8::String>(); |
| 194 } | 194 } |
| 195 | 195 |
| 196 DEFINE_TRACE(ScriptPromisePropertyBase) | 196 DEFINE_TRACE(ScriptPromisePropertyBase) |
| 197 { | 197 { |
| 198 ContextLifecycleObserver::trace(visitor); | 198 ContextLifecycleObserver::trace(visitor); |
| 199 } | 199 } |
| 200 | 200 |
| 201 } // namespace blink | 201 } // namespace blink |
| OLD | NEW |