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

Unified Diff: src/js/promise.js

Issue 2590563003: [promises] Remove deferred object (Closed)
Patch Set: fix test Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: src/js/promise.js
diff --git a/src/js/promise.js b/src/js/promise.js
index 7cd789295644f8be560f8c85346fd9c279720024..626a8da0ff4b265ca6ba0e4ec5ae5cbf14f8e920 100644
--- a/src/js/promise.js
+++ b/src/js/promise.js
@@ -39,7 +39,7 @@ utils.Import(function(from) {
// Core functionality.
-function PromiseDebugGetInfo(deferreds, status) {
+function PromiseDebugGetInfo(deferred_promise, status) {
var id, name, instrumenting = DEBUG_IS_ACTIVE;
if (instrumenting) {
@@ -49,11 +49,11 @@ function PromiseDebugGetInfo(deferreds, status) {
// functions will not get a good stack trace, as async functions require
// different stacks from direct Promise use, but we save and restore a
// stack once for all reactions. TODO(littledan): Improve this case.
- if (!IS_UNDEFINED(deferreds) &&
- HAS_PRIVATE(deferreds.promise, promiseHandledBySymbol) &&
- HAS_PRIVATE(GET_PRIVATE(deferreds.promise, promiseHandledBySymbol),
+ if (!IS_UNDEFINED(deferred_promise) &&
+ HAS_PRIVATE(deferred_promise, promiseHandledBySymbol) &&
+ HAS_PRIVATE(GET_PRIVATE(deferred_promise, promiseHandledBySymbol),
promiseAsyncStackIDSymbol)) {
- id = GET_PRIVATE(GET_PRIVATE(deferreds.promise, promiseHandledBySymbol),
+ id = GET_PRIVATE(GET_PRIVATE(deferred_promise, promiseHandledBySymbol),
promiseAsyncStackIDSymbol);
name = "async function";
} else {
@@ -75,8 +75,8 @@ SET_PRIVATE(PromiseIdRejectHandler, promiseForwardingHandlerSymbol, true);
// For bootstrapper.
// This is used by utils and v8-extras.
-function PromiseCreate() {
- return %promise_internal_constructor(UNDEFINED);
+function PromiseCreate(parent) {
+ return %promise_internal_constructor(parent);
}
// Only used by async-await.js
@@ -89,17 +89,6 @@ function DoRejectPromise(promise, reason) {
%PromiseReject(promise, reason, true);
}
-// The resultCapability.promise is only ever fulfilled internally,
-// so we don't need the closures to protect against accidentally
-// calling them multiple times.
-function CreateInternalPromiseCapability(parent) {
- return {
- promise: %promise_internal_constructor(parent),
- resolve: UNDEFINED,
- reject: UNDEFINED
- };
-}
-
// ES#sec-newpromisecapability
// NewPromiseCapability ( C )
function NewPromiseCapability(C, debugEvent) {
@@ -280,7 +269,7 @@ function PromiseRace(iterable) {
// Utility for debugger
-function PromiseHasUserDefinedRejectHandlerCheck(handler, deferred) {
+function PromiseHasUserDefinedRejectHandlerCheck(handler, deferred_promise) {
// Recurse to the forwarding Promise, if any. This may be due to
// - await reaction forwarding to the throwaway Promise, which has
// a dependency edge to the outer Promise.
@@ -288,7 +277,7 @@ function PromiseHasUserDefinedRejectHandlerCheck(handler, deferred) {
// - Promise.all/Promise.race forwarding to a throwaway Promise, which
// has a dependency edge to the generated outer Promise.
if (GET_PRIVATE(handler, promiseForwardingHandlerSymbol)) {
- return PromiseHasUserDefinedRejectHandlerRecursive(deferred.promise);
+ return PromiseHasUserDefinedRejectHandlerRecursive(deferred_promise);
}
// Otherwise, this is a real reject handler for the Promise
@@ -371,7 +360,6 @@ utils.InstallGetter(GlobalPromise, speciesSymbol, PromiseSpecies);
"promise_internal_reject", RejectPromise,
"promise_debug_get_info", PromiseDebugGetInfo,
"new_promise_capability", NewPromiseCapability,
- "internal_promise_capability", CreateInternalPromiseCapability,
"promise_id_resolve_handler", PromiseIdResolveHandler,
"promise_id_reject_handler", PromiseIdRejectHandler
]);
@@ -389,7 +377,6 @@ utils.Export(function(to) {
to.PromiseCreate = PromiseCreate;
to.PromiseThen = PromiseThen;
- to.CreateInternalPromiseCapability = CreateInternalPromiseCapability;
to.RejectPromise = RejectPromise;
});

Powered by Google App Engine
This is Rietveld 408576698