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

Unified Diff: src/runtime/runtime-promise.cc

Issue 2633443002: [promisehook] Pass deferred promise to Before/After callback (Closed)
Patch Set: Remove adaptor 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects-printer.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-promise.cc
diff --git a/src/runtime/runtime-promise.cc b/src/runtime/runtime-promise.cc
index 6fbf4742c0868bbd95caff1d08454132bf1af32e..14667114ba9cedbd546c82ee7810859f8f2d8adf 100644
--- a/src/runtime/runtime-promise.cc
+++ b/src/runtime/runtime-promise.cc
@@ -110,15 +110,15 @@ bool GetDebugIdForAsyncFunction(Isolate* isolate,
return true;
}
-void SetDebugInfo(Isolate* isolate, Handle<PromiseReactionJobInfo> info,
- int status) {
+void SetDebugInfo(Isolate* isolate, Handle<JSPromise> promise,
+ Handle<PromiseReactionJobInfo> info, int status) {
int id;
PromiseDebugActionName name;
if (GetDebugIdForAsyncFunction(isolate, info, &id)) {
name = kDebugAsyncFunction;
} else {
- id = isolate->debug()->NextAsyncTaskId(handle(info->promise(), isolate));
+ id = isolate->debug()->NextAsyncTaskId(promise);
DCHECK(status != v8::Promise::kPending);
name = status == v8::Promise::kFulfilled ? kDebugPromiseResolve
: kDebugPromiseReject;
@@ -128,11 +128,11 @@ void SetDebugInfo(Isolate* isolate, Handle<PromiseReactionJobInfo> info,
info->set_debug_name(name);
}
-void EnqueuePromiseReactionJob(Isolate* isolate,
+void EnqueuePromiseReactionJob(Isolate* isolate, Handle<JSPromise> promise,
Handle<PromiseReactionJobInfo> info,
int status) {
if (isolate->debug()->is_active()) {
- SetDebugInfo(isolate, info, status);
+ SetDebugInfo(isolate, promise, info, status);
}
isolate->EnqueueMicrotask(info);
@@ -166,11 +166,11 @@ void PromiseFulfill(Isolate* isolate, Handle<JSPromise> promise, int status,
isolate);
Handle<PromiseReactionJobInfo> info =
isolate->factory()->NewPromiseReactionJobInfo(
- promise, value, tasks, handle(promise->deferred_promise(), isolate),
+ value, tasks, handle(promise->deferred_promise(), isolate),
handle(promise->deferred_on_resolve(), isolate),
handle(promise->deferred_on_reject(), isolate),
isolate->native_context());
- EnqueuePromiseReactionJob(isolate, info, status);
+ EnqueuePromiseReactionJob(isolate, promise, info, status);
}
PromiseSet(isolate, promise, status, value);
@@ -193,10 +193,11 @@ RUNTIME_FUNCTION(Runtime_PromiseReject) {
RUNTIME_FUNCTION(Runtime_EnqueuePromiseReactionJob) {
HandleScope scope(isolate);
- DCHECK_EQ(2, args.length());
- CONVERT_ARG_HANDLE_CHECKED(PromiseReactionJobInfo, info, 0);
- CONVERT_SMI_ARG_CHECKED(status, 1);
- EnqueuePromiseReactionJob(isolate, info, status);
+ DCHECK_EQ(3, args.length());
+ CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
+ CONVERT_ARG_HANDLE_CHECKED(PromiseReactionJobInfo, info, 1);
+ CONVERT_SMI_ARG_CHECKED(status, 2);
+ EnqueuePromiseReactionJob(isolate, promise, info, status);
return isolate->heap()->undefined_value();
}
« no previous file with comments | « src/objects-printer.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698