Index: src/debug/debug.cc |
diff --git a/src/debug/debug.cc b/src/debug/debug.cc |
index 5cb9c6f8b2d554fc7e096a915f881bafe42390c7..c683a7f4f0a309fbcfb7087b3a5abc8e46835e08 100644 |
--- a/src/debug/debug.cc |
+++ b/src/debug/debug.cc |
@@ -1874,17 +1874,7 @@ void Debug::OnAsyncTaskEvent(debug::PromiseDebugActionType type, int id) { |
if (async_task_listener_) { |
async_task_listener_(type, id, async_task_listener_data_); |
- // There are three types of event listeners: C++ message_handler, |
- // JavaScript event listener and C++ event listener. |
- // Currently inspector still uses C++ event listener and installs |
- // more specific event listeners for part of events. Calling of |
- // C++ event listener is redundant when more specific event listener |
- // is presented. Other clients can install JavaScript event listener |
- // (e.g. some of NodeJS module). |
- bool non_inspector_listener_exists = |
- message_handler_ != nullptr || |
- (event_listener_.is_null() && !event_listener_->IsForeign()); |
- if (!non_inspector_listener_exists) return; |
+ if (!non_inspector_listener_exists()) return; |
} |
HandleScope scope(isolate_); |
@@ -1963,6 +1953,12 @@ void Debug::CallEventCallback(v8::DebugEvent event, |
in_debug_event_listener_ = previous; |
} |
+void Debug::SetCompileEventListener(debug::CompileEventListener listener, |
+ void* data) { |
+ compile_event_listener_ = listener; |
+ compile_event_listener_data_ = data; |
+ UpdateState(); |
+} |
void Debug::ProcessCompileEvent(v8::DebugEvent event, Handle<Script> script) { |
if (ignore_events()) return; |
@@ -1972,6 +1968,13 @@ void Debug::ProcessCompileEvent(v8::DebugEvent event, Handle<Script> script) { |
} |
SuppressDebug while_processing(this); |
kozy
2017/01/17 17:14:09
test/debug relies on this (e.g. debug-step-stub-ca
jgruber
2017/01/18 10:25:34
Good point, the current solution in test-api.js is
|
+ if (compile_event_listener_) { |
+ compile_event_listener_(ToApiHandle<debug::Script>(script), |
+ event != v8::AfterCompile, |
+ compile_event_listener_data_); |
+ if (!non_inspector_listener_exists()) return; |
+ } |
+ |
bool in_nested_debug_scope = in_debug_scope(); |
HandleScope scope(isolate_); |
DebugScope debug_scope(this); |
Yang
2017/01/18 11:41:08
I think we need to move the DebugScope above the c
kozy
2017/01/18 20:00:02
Done.
|
@@ -2170,7 +2173,8 @@ void Debug::SetMessageHandler(v8::Debug::MessageHandler handler) { |
void Debug::UpdateState() { |
bool is_active = message_handler_ != nullptr || !event_listener_.is_null() || |
- async_task_listener_ != nullptr; |
+ async_task_listener_ != nullptr || |
+ compile_event_listener_ != nullptr; |
if (is_active || in_debug_scope()) { |
// Note that the debug context could have already been loaded to |
// bootstrap test cases. |