Index: src/isolate.cc |
diff --git a/src/isolate.cc b/src/isolate.cc |
index 8979a7b479312fe0797c5bfefcc1015029f44750..246d5180e92de590a32abece76d3c397d9111103 100644 |
--- a/src/isolate.cc |
+++ b/src/isolate.cc |
@@ -2151,7 +2151,7 @@ Isolate::Isolate(bool enable_serializer) |
serializer_enabled_(enable_serializer), |
has_fatal_error_(false), |
initialized_from_snapshot_(false), |
- is_promisehook_enabled_(false), |
+ is_promise_hook_enabled_(false), |
is_tail_call_elimination_enabled_(true), |
is_isolate_in_background_(false), |
cpu_profiler_(NULL), |
@@ -3168,9 +3168,18 @@ void Isolate::FireCallCompletedCallback() { |
} |
} |
-void Isolate::EnablePromiseHook() { is_promisehook_enabled_ = true; } |
+void Isolate::SetPromiseHook(PromiseHook hook) { |
+ is_promise_hook_enabled_ = hook != nullptr; |
adamk
2016/12/15 08:46:09
Is there a reason we still need to track this sepa
gsathya
2016/12/15 15:35:33
I thought the boolean was cleaner. Changed.
adamk
2016/12/15 15:43:58
I prefer this way to avoid having to do extra book
|
+ set_promise_hook(hook); |
+} |
-void Isolate::DisablePromiseHook() { is_promisehook_enabled_ = false; } |
+void Isolate::RunPromiseHook(PromiseHookType type, Handle<JSObject> promise, |
+ Handle<Object> parent) { |
+ if (!is_promise_hook_enabled_) return; |
+ PromiseHook hook = promise_hook(); |
+ HandleScope scope(this); |
adamk
2016/12/15 08:46:09
Where is this called from where there isn't alread
gsathya
2016/12/15 15:35:33
I don't create handlescopes in the runtime functio
adamk
2016/12/15 15:43:58
Ah, you should create HandleScopes there :)
|
+ hook(type, v8::Utils::PromiseToLocal(promise), v8::Utils::ToLocal(parent)); |
+} |
void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { |
promise_reject_callback_ = callback; |