OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project 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 (function(global, utils, extrasUtils) { | 5 (function(global, utils, extrasUtils) { |
6 | 6 |
7 "use strict"; | 7 "use strict"; |
8 | 8 |
9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
10 | 10 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // If debug is active, notify about the newly created promise first. | 136 // If debug is active, notify about the newly created promise first. |
137 if (DEBUG_IS_ACTIVE) PromiseSet(promise, kPending, UNDEFINED); | 137 if (DEBUG_IS_ACTIVE) PromiseSet(promise, kPending, UNDEFINED); |
138 return PromiseSet(promise, status, value); | 138 return PromiseSet(promise, status, value); |
139 } | 139 } |
140 | 140 |
141 function PromiseInit(promise) { | 141 function PromiseInit(promise) { |
142 return PromiseSet(promise, kPending, UNDEFINED); | 142 return PromiseSet(promise, kPending, UNDEFINED); |
143 } | 143 } |
144 | 144 |
145 function FulfillPromise(promise, status, value, promiseQueue) { | 145 function FulfillPromise(promise, status, value, promiseQueue) { |
146 var tasks = GET_PRIVATE(promise, promiseQueue); | 146 %PromiseFulfill(promise, status, value, promiseQueue); |
147 if (!IS_UNDEFINED(tasks)) { | |
148 var deferred = GET_PRIVATE(promise, promiseDeferredReactionSymbol); | |
149 %EnqueuePromiseReactionJob(value, tasks, deferred, status); | |
150 } | |
151 PromiseSet(promise, status, value); | 147 PromiseSet(promise, status, value); |
152 } | 148 } |
153 | 149 |
154 function PromiseHandle(value, handler, deferred) { | 150 function PromiseHandle(value, handler, deferred) { |
155 var debug_is_active = DEBUG_IS_ACTIVE; | 151 var debug_is_active = DEBUG_IS_ACTIVE; |
156 try { | 152 try { |
157 if (debug_is_active) %DebugPushPromise(deferred.promise); | 153 if (debug_is_active) %DebugPushPromise(deferred.promise); |
158 var result = handler(value); | 154 var result = handler(value); |
159 if (IS_UNDEFINED(deferred.resolve)) { | 155 if (IS_UNDEFINED(deferred.resolve)) { |
160 ResolvePromise(deferred.promise, result); | 156 ResolvePromise(deferred.promise, result); |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 to.PromiseThen = PromiseThen; | 672 to.PromiseThen = PromiseThen; |
677 | 673 |
678 to.GlobalPromise = GlobalPromise; | 674 to.GlobalPromise = GlobalPromise; |
679 to.NewPromiseCapability = NewPromiseCapability; | 675 to.NewPromiseCapability = NewPromiseCapability; |
680 to.PerformPromiseThen = PerformPromiseThen; | 676 to.PerformPromiseThen = PerformPromiseThen; |
681 to.ResolvePromise = ResolvePromise; | 677 to.ResolvePromise = ResolvePromise; |
682 to.RejectPromise = RejectPromise; | 678 to.RejectPromise = RejectPromise; |
683 }); | 679 }); |
684 | 680 |
685 }) | 681 }) |
OLD | NEW |