| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 : ScriptPromisePropertyBase(executionContext, name), m_holder(holder) {} | 98 : ScriptPromisePropertyBase(executionContext, name), m_holder(holder) {} |
| 99 | 99 |
| 100 template <typename HolderType, typename ResolvedType, typename RejectedType> | 100 template <typename HolderType, typename ResolvedType, typename RejectedType> |
| 101 template <typename PassResolvedType> | 101 template <typename PassResolvedType> |
| 102 void ScriptPromiseProperty<HolderType, ResolvedType, RejectedType>::resolve( | 102 void ScriptPromiseProperty<HolderType, ResolvedType, RejectedType>::resolve( |
| 103 PassResolvedType value) { | 103 PassResolvedType value) { |
| 104 if (getState() != Pending) { | 104 if (getState() != Pending) { |
| 105 NOTREACHED(); | 105 NOTREACHED(); |
| 106 return; | 106 return; |
| 107 } | 107 } |
| 108 DCHECK(!ScriptForbiddenScope::isScriptForbidden()); |
| 108 if (!getExecutionContext() || getExecutionContext()->isContextDestroyed()) | 109 if (!getExecutionContext() || getExecutionContext()->isContextDestroyed()) |
| 109 return; | 110 return; |
| 110 m_resolved = value; | 111 m_resolved = value; |
| 111 resolveOrReject(Resolved); | 112 resolveOrReject(Resolved); |
| 112 } | 113 } |
| 113 | 114 |
| 114 template <typename HolderType, typename ResolvedType, typename RejectedType> | 115 template <typename HolderType, typename ResolvedType, typename RejectedType> |
| 115 void ScriptPromiseProperty<HolderType, ResolvedType, RejectedType>:: | 116 void ScriptPromiseProperty<HolderType, ResolvedType, RejectedType>:: |
| 116 resolveWithUndefined() { | 117 resolveWithUndefined() { |
| 117 if (getState() != Pending) { | 118 if (getState() != Pending) { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 VisitorDispatcher visitor) { | 195 VisitorDispatcher visitor) { |
| 195 TraceIfNeeded<HolderType>::trace(visitor, m_holder); | 196 TraceIfNeeded<HolderType>::trace(visitor, m_holder); |
| 196 TraceIfNeeded<ResolvedType>::trace(visitor, m_resolved); | 197 TraceIfNeeded<ResolvedType>::trace(visitor, m_resolved); |
| 197 TraceIfNeeded<RejectedType>::trace(visitor, m_rejected); | 198 TraceIfNeeded<RejectedType>::trace(visitor, m_rejected); |
| 198 ScriptPromisePropertyBase::trace(visitor); | 199 ScriptPromisePropertyBase::trace(visitor); |
| 199 } | 200 } |
| 200 | 201 |
| 201 } // namespace blink | 202 } // namespace blink |
| 202 | 203 |
| 203 #endif // ScriptPromiseProperty_h | 204 #endif // ScriptPromiseProperty_h |
| OLD | NEW |