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

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

Issue 2578923002: [inspector] async stacks for Promise.then calls... (Closed)
Patch Set: added missing handle scope 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/runtime/runtime-promise.cc
diff --git a/src/runtime/runtime-promise.cc b/src/runtime/runtime-promise.cc
index f609df73fd6e7864266e54e640291a14ecefaca2..47332544a5949427a71bffd2502b0add0ac19be1 100644
--- a/src/runtime/runtime-promise.cc
+++ b/src/runtime/runtime-promise.cc
@@ -69,8 +69,8 @@ void EnqueuePromiseReactionJob(Isolate* isolate, Handle<JSPromise> promise,
if (deferred->IsFixedArray()) {
deferred_obj = isolate->factory()->undefined_value();
}
-
- Handle<Object> argv[] = {deferred_obj, status};
+ Handle<Object> argv[] = {deferred_obj, status,
+ isolate->debug()->NextAsyncTaskId(promise)};
maybe_result = Execution::TryCall(
isolate, isolate->promise_debug_get_info(),
isolate->factory()->undefined_value(), arraysize(argv), argv);
@@ -104,6 +104,14 @@ void PromiseSet(Isolate* isolate, Handle<JSPromise> promise, int status,
void PromiseFulfill(Isolate* isolate, Handle<JSPromise> promise,
Handle<Smi> status, Handle<Object> value) {
+ if (isolate->debug()->is_active()) {
+ isolate->debug()->OnAsyncTaskEvent(
+ debug::EnqueueRecurring, isolate->debug()->NextAsyncTaskId(promise),
+ status->value() == kPromiseFulfilled
+ ? isolate->factory()->PromiseResolve_string()
+ : isolate->factory()->PromiseReject_string());
+ }
+
// Check if there are any callbacks.
if (!promise->deferred()->IsUndefined(isolate)) {
Handle<Object> tasks((status->value() == kPromiseFulfilled)
@@ -171,12 +179,8 @@ RUNTIME_FUNCTION(Runtime_EnqueuePromiseResolveThenableJob) {
Handle<Object> debug_id, debug_name;
if (isolate->debug()->is_active()) {
- debug_id =
- handle(Smi::FromInt(isolate->GetNextDebugMicrotaskId()), isolate);
+ debug_id = isolate->debug()->NextAsyncTaskId(promise);
debug_name = isolate->factory()->PromiseResolveThenableJob_string();
- isolate->debug()->OnAsyncTaskEvent(isolate->factory()->enqueue_string(),
- debug_id,
- Handle<String>::cast(debug_name));
} else {
debug_id = isolate->factory()->undefined_value();
debug_name = isolate->factory()->undefined_value();

Powered by Google App Engine
This is Rietveld 408576698