| 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 "bindings/core/v8/ScriptPromisePropertyBase.h" | 5 #include "bindings/core/v8/ScriptPromisePropertyBase.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScopedPersistent.h" | 7 #include "bindings/core/v8/ScopedPersistent.h" |
| 8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
| 9 #include "bindings/core/v8/V8Binding.h" | 9 #include "bindings/core/v8/V8Binding.h" |
| 10 #include "bindings/core/v8/V8HiddenValue.h" | 10 #include "bindings/core/v8/V8HiddenValue.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 } | 106 } |
| 107 | 107 |
| 108 void ScriptPromisePropertyBase::resolveOrRejectInternal(v8::Local<v8::Promise::R
esolver> resolver) | 108 void ScriptPromisePropertyBase::resolveOrRejectInternal(v8::Local<v8::Promise::R
esolver> resolver) |
| 109 { | 109 { |
| 110 v8::Local<v8::Context> context = resolver->CreationContext(); | 110 v8::Local<v8::Context> context = resolver->CreationContext(); |
| 111 switch (m_state) { | 111 switch (m_state) { |
| 112 case Pending: | 112 case Pending: |
| 113 ASSERT_NOT_REACHED(); | 113 ASSERT_NOT_REACHED(); |
| 114 break; | 114 break; |
| 115 case Resolved: | 115 case Resolved: |
| 116 resolver->Resolve(context, resolvedValue(m_isolate, context->Global())); | 116 if (resolver->Resolve(context, resolvedValue(m_isolate, context->Global(
))).IsNothing()) { |
| 117 // TODO: What action, if any, should be taken here? |
| 118 } |
| 117 break; | 119 break; |
| 118 case Rejected: | 120 case Rejected: |
| 119 resolver->Reject(context, rejectedValue(m_isolate, context->Global())); | 121 if (resolver->Reject(context, rejectedValue(m_isolate, context->Global()
)).IsNothing()) { |
| 122 // TODO: What action, if any, should be taken here? |
| 123 } |
| 120 break; | 124 break; |
| 121 } | 125 } |
| 122 } | 126 } |
| 123 | 127 |
| 124 v8::Local<v8::Object> ScriptPromisePropertyBase::ensureHolderWrapper(ScriptState
* scriptState) | 128 v8::Local<v8::Object> ScriptPromisePropertyBase::ensureHolderWrapper(ScriptState
* scriptState) |
| 125 { | 129 { |
| 126 v8::Local<v8::Context> context = scriptState->context(); | 130 v8::Local<v8::Context> context = scriptState->context(); |
| 127 size_t i = 0; | 131 size_t i = 0; |
| 128 while (i < m_wrappers.size()) { | 132 while (i < m_wrappers.size()) { |
| 129 const std::unique_ptr<ScopedPersistent<v8::Object>>& persistent = m_wrap
pers[i]; | 133 const std::unique_ptr<ScopedPersistent<v8::Object>>& persistent = m_wrap
pers[i]; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 ASSERT_NOT_REACHED(); | 209 ASSERT_NOT_REACHED(); |
| 206 return v8::Local<v8::String>(); | 210 return v8::Local<v8::String>(); |
| 207 } | 211 } |
| 208 | 212 |
| 209 DEFINE_TRACE(ScriptPromisePropertyBase) | 213 DEFINE_TRACE(ScriptPromisePropertyBase) |
| 210 { | 214 { |
| 211 ContextLifecycleObserver::trace(visitor); | 215 ContextLifecycleObserver::trace(visitor); |
| 212 } | 216 } |
| 213 | 217 |
| 214 } // namespace blink | 218 } // namespace blink |
| OLD | NEW |