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 18 matching lines...) Expand all Loading... |
29 // ------------------------------------------------------------------- | 29 // ------------------------------------------------------------------- |
30 // Define exported functions. | 30 // Define exported functions. |
31 | 31 |
32 // For bootstrapper. | 32 // For bootstrapper. |
33 | 33 |
34 // This is used by utils and v8-extras. | 34 // This is used by utils and v8-extras. |
35 function PromiseCreate(parent) { | 35 function PromiseCreate(parent) { |
36 return %promise_internal_constructor(parent); | 36 return %promise_internal_constructor(parent); |
37 } | 37 } |
38 | 38 |
39 // Only used by async-await.js | |
40 function RejectPromise(promise, reason, debugEvent) { | |
41 %PromiseReject(promise, reason, debugEvent); | |
42 } | |
43 | |
44 // Export to bindings | 39 // Export to bindings |
45 function DoRejectPromise(promise, reason) { | 40 function DoRejectPromise(promise, reason) { |
46 %PromiseReject(promise, reason, true); | 41 %PromiseReject(promise, reason, true); |
47 } | 42 } |
48 | 43 |
49 // Combinators. | 44 // Combinators. |
50 | 45 |
51 // ES#sec-promise.all | 46 // ES#sec-promise.all |
52 // Promise.all ( iterable ) | 47 // Promise.all ( iterable ) |
53 function PromiseAll(iterable) { | 48 function PromiseAll(iterable) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 162 |
168 // This allows extras to create promises quickly without building extra | 163 // This allows extras to create promises quickly without building extra |
169 // resolve/reject closures, and allows them to later resolve and reject any | 164 // resolve/reject closures, and allows them to later resolve and reject any |
170 // promise without having to hold on to those closures forever. | 165 // promise without having to hold on to those closures forever. |
171 utils.InstallFunctions(extrasUtils, 0, [ | 166 utils.InstallFunctions(extrasUtils, 0, [ |
172 "createPromise", PromiseCreate, | 167 "createPromise", PromiseCreate, |
173 "rejectPromise", DoRejectPromise, | 168 "rejectPromise", DoRejectPromise, |
174 "markPromiseAsHandled", MarkPromiseAsHandled | 169 "markPromiseAsHandled", MarkPromiseAsHandled |
175 ]); | 170 ]); |
176 | 171 |
177 utils.Export(function(to) { | |
178 to.PromiseCreate = PromiseCreate; | |
179 to.RejectPromise = RejectPromise; | |
180 }); | |
181 | |
182 }) | 172 }) |
OLD | NEW |