Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Ostroukhov <eostroukhov@google.com>2018-05-22 02:59:04 +0300
committerAnna Henningsen <anna@addaleax.net>2018-07-14 00:42:50 +0300
commit39977db7c015e94d33885249f50e62fa8b1f1bb9 (patch)
treefb330cb04106d7a030b1599549f5503c3ea086ea /src/inspector_js_api.cc
parent9374a83d6983710844c5436f32c14242ba600a20 (diff)
inspector: split main thread interface from transport
Workers debugging will require interfacing between the "main" inspector and per-worker isolate inspectors. This is consistent with what WS interface does. This change is a refactoring change and does not change the functionality. PR-URL: https://github.com/nodejs/node/pull/21182 Fixes: https://github.com/nodejs/node/issues/21725 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/inspector_js_api.cc')
-rw-r--r--src/inspector_js_api.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/inspector_js_api.cc b/src/inspector_js_api.cc
index 9a74f4d1098..a8e2e8ecafe 100644
--- a/src/inspector_js_api.cc
+++ b/src/inspector_js_api.cc
@@ -66,7 +66,7 @@ class JSBindingsConnection : public AsyncWrap {
callback_(env->isolate(), callback) {
Agent* inspector = env->inspector_agent();
session_ = inspector->Connect(std::unique_ptr<JSBindingsSessionDelegate>(
- new JSBindingsSessionDelegate(env, this)));
+ new JSBindingsSessionDelegate(env, this)), false);
}
void OnMessage(Local<Value> value) {
@@ -116,7 +116,7 @@ class JSBindingsConnection : public AsyncWrap {
static bool InspectorEnabled(Environment* env) {
Agent* agent = env->inspector_agent();
- return agent->io() != nullptr || agent->HasConnectedSessions();
+ return agent->IsActive();
}
void AddCommandLineAPI(const FunctionCallbackInfo<Value>& info) {
@@ -251,8 +251,9 @@ void Open(const FunctionCallbackInfo<Value>& args) {
if (args.Length() > 2 && args[2]->IsBoolean()) {
wait_for_connect = args[2]->BooleanValue(env->context()).FromJust();
}
-
- agent->StartIoThread(wait_for_connect);
+ agent->StartIoThread();
+ if (wait_for_connect)
+ agent->WaitForConnect();
}
void Url(const FunctionCallbackInfo<Value>& args) {
@@ -283,7 +284,7 @@ void Initialize(Local<Object> target, Local<Value> unused,
Agent* agent = env->inspector_agent();
env->SetMethod(target, "consoleCall", InspectorConsoleCall);
env->SetMethod(target, "addCommandLineAPI", AddCommandLineAPI);
- if (agent->IsWaitingForConnect())
+ if (agent->WillWaitForConnect())
env->SetMethod(target, "callAndPauseOnStart", CallAndPauseOnStart);
env->SetMethod(target, "open", Open);
env->SetMethodNoSideEffect(target, "url", Url);