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

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

Issue 2578923002: [inspector] async stacks for Promise.then calls... (Closed)
Patch Set: avoid calling functions 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/runtime/runtime-debug.cc ('k') | test/inspector/debugger/async-instrumentation.js » ('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 ace8db8b89bb288cdd7f910b9d65355665f3a507..6fbf4742c0868bbd95caff1d08454132bf1af32e 100644
--- a/src/runtime/runtime-promise.cc
+++ b/src/runtime/runtime-promise.cc
@@ -43,6 +43,9 @@ RUNTIME_FUNCTION(Runtime_PromiseRejectEventFromStack) {
// undefined, which will be interpreted by PromiseRejectEvent
// as being a caught exception event.
rejected_promise = isolate->GetPromiseOnStackOnThrow();
+ isolate->debug()->OnAsyncTaskEvent(
+ debug::kDebugEnqueueRecurring,
+ isolate->debug()->NextAsyncTaskId(promise), kDebugPromiseReject);
}
PromiseRejectEvent(isolate, promise, rejected_promise, value, true);
return isolate->heap()->undefined_value();
@@ -115,13 +118,10 @@ void SetDebugInfo(Isolate* isolate, Handle<PromiseReactionJobInfo> info,
if (GetDebugIdForAsyncFunction(isolate, info, &id)) {
name = kDebugAsyncFunction;
} else {
- id = isolate->GetNextDebugMicrotaskId();
-
+ id = isolate->debug()->NextAsyncTaskId(handle(info->promise(), isolate));
DCHECK(status != v8::Promise::kPending);
name = status == v8::Promise::kFulfilled ? kDebugPromiseResolve
: kDebugPromiseReject;
-
- isolate->debug()->OnAsyncTaskEvent(kDebugEnqueue, id, name);
}
info->set_debug_id(id);
@@ -151,6 +151,13 @@ void PromiseSet(Isolate* isolate, Handle<JSPromise> promise, int status,
void PromiseFulfill(Isolate* isolate, Handle<JSPromise> promise, int status,
Handle<Object> value) {
+ if (isolate->debug()->is_active()) {
+ isolate->debug()->OnAsyncTaskEvent(
+ debug::kDebugEnqueueRecurring,
+ isolate->debug()->NextAsyncTaskId(promise),
+ status == v8::Promise::kFulfilled ? kDebugPromiseResolve
+ : kDebugPromiseReject);
+ }
// Check if there are any callbacks.
if (!promise->deferred_promise()->IsUndefined(isolate)) {
Handle<Object> tasks((status == v8::Promise::kFulfilled)
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | test/inspector/debugger/async-instrumentation.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698