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

Unified Diff: src/isolate.cc

Issue 2575313002: [promisehook] Implement PromiseHook (Closed)
Patch Set: rebase + add comments 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
« no previous file with comments | « src/isolate.h ('k') | src/js/async-await.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index 4f9f2cb3f9e491280ece4c280dc71a4051b6b37d..74d533c88ee452910212298c9ad0a3df4e9edc78 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -2148,11 +2148,11 @@ Isolate::Isolate(bool enable_serializer)
// be fixed once the default isolate cleanup is done.
random_number_generator_(NULL),
rail_mode_(PERFORMANCE_ANIMATION),
+ promise_hook_(NULL),
load_start_time_ms_(0),
serializer_enabled_(enable_serializer),
has_fatal_error_(false),
initialized_from_snapshot_(false),
- is_promisehook_enabled_(false),
is_tail_call_elimination_enabled_(true),
is_isolate_in_background_(false),
cpu_profiler_(NULL),
@@ -3170,9 +3170,14 @@ void Isolate::FireCallCompletedCallback() {
}
}
-void Isolate::EnablePromiseHook() { is_promisehook_enabled_ = true; }
+void Isolate::SetPromiseHook(PromiseHook hook) { promise_hook_ = hook; }
-void Isolate::DisablePromiseHook() { is_promisehook_enabled_ = false; }
+void Isolate::RunPromiseHook(PromiseHookType type, Handle<JSPromise> promise,
+ Handle<Object> parent) {
+ if (promise_hook_ == nullptr) return;
+ promise_hook_(type, v8::Utils::PromiseToLocal(promise),
+ v8::Utils::ToLocal(parent));
+}
void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) {
promise_reject_callback_ = callback;
« no previous file with comments | « src/isolate.h ('k') | src/js/async-await.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698