Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(808)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScriptPromiseProperty.h

Issue 2615253002: Resolve ready and finished promises asynchronously (Closed)
Patch Set: Fix nits Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/animation/Animation.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/animation/Animation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698