Chromium Code Reviews| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 // Define exported functions. | 65 // Define exported functions. |
| 66 | 66 |
| 67 // For bootstrapper. | 67 // For bootstrapper. |
| 68 | 68 |
| 69 // This is used by utils and v8-extras. | 69 // This is used by utils and v8-extras. |
| 70 function PromiseCreate() { | 70 function PromiseCreate() { |
| 71 return %promise_internal_constructor(UNDEFINED); | 71 return %promise_internal_constructor(UNDEFINED); |
| 72 } | 72 } |
| 73 | 73 |
| 74 // Only used by async-await.js | 74 // Only used by async-await.js |
| 75 function RejectPromise(promise, reason, debugEvent) { | 75 function RejectPromise(promise, reason, debugEvent) { |
|
gsathya
2016/12/22 16:19:01
Can this be removed?
Dan Ehrenberg
2016/12/22 16:22:32
Yeah, seems like we could remove promise_internal_
| |
| 76 %PromiseReject(promise, reason, debugEvent); | 76 %PromiseReject(promise, reason, debugEvent); |
| 77 } | 77 } |
| 78 | 78 |
| 79 // Export to bindings | 79 // Export to bindings |
| 80 function DoRejectPromise(promise, reason) { | 80 function DoRejectPromise(promise, reason) { |
| 81 %PromiseReject(promise, reason, true); | 81 %PromiseReject(promise, reason, true); |
| 82 } | 82 } |
| 83 | 83 |
| 84 // The resultCapability.promise is only ever fulfilled internally, | 84 // The resultCapability.promise is only ever fulfilled internally, |
| 85 // so we don't need the closures to protect against accidentally | 85 // so we don't need the closures to protect against accidentally |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 355 // This allows extras to create promises quickly without building extra | 355 // This allows extras to create promises quickly without building extra |
| 356 // resolve/reject closures, and allows them to later resolve and reject any | 356 // resolve/reject closures, and allows them to later resolve and reject any |
| 357 // promise without having to hold on to those closures forever. | 357 // promise without having to hold on to those closures forever. |
| 358 utils.InstallFunctions(extrasUtils, 0, [ | 358 utils.InstallFunctions(extrasUtils, 0, [ |
| 359 "createPromise", PromiseCreate, | 359 "createPromise", PromiseCreate, |
| 360 "rejectPromise", DoRejectPromise, | 360 "rejectPromise", DoRejectPromise, |
| 361 "markPromiseAsHandled", MarkPromiseAsHandled | 361 "markPromiseAsHandled", MarkPromiseAsHandled |
| 362 ]); | 362 ]); |
| 363 | 363 |
| 364 utils.Export(function(to) { | 364 utils.Export(function(to) { |
| 365 to.PromiseCreate = PromiseCreate; | |
| 366 | |
| 367 to.CreateInternalPromiseCapability = CreateInternalPromiseCapability; | 365 to.CreateInternalPromiseCapability = CreateInternalPromiseCapability; |
| 368 to.RejectPromise = RejectPromise; | |
| 369 }); | 366 }); |
| 370 | 367 |
| 371 }) | 368 }) |
| OLD | NEW |