diff --git a/src/env.h b/src/env.h index 6ffacd47212571..4259c82be96a27 100644 --- a/src/env.h +++ b/src/env.h @@ -872,7 +872,8 @@ class Environment : public MemoryRetainer { #if HAVE_INSPECTOR // If the environment is created for a worker, pass parent_handle and // the ownership if transferred into the Environment. - int InitializeInspector(inspector::ParentInspectorHandle* parent_handle); + int InitializeInspector( + std::unique_ptr parent_handle); #endif v8::MaybeLocal BootstrapInternalLoaders(); diff --git a/src/node.cc b/src/node.cc index 81b29dbf337bf9..fc6b919ece2fed 100644 --- a/src/node.cc +++ b/src/node.cc @@ -196,13 +196,12 @@ MaybeLocal ExecuteBootstrapper(Environment* env, #if HAVE_INSPECTOR int Environment::InitializeInspector( - inspector::ParentInspectorHandle* parent_handle) { + std::unique_ptr parent_handle) { std::string inspector_path; - if (parent_handle != nullptr) { + if (parent_handle) { DCHECK(!is_main_thread()); inspector_path = parent_handle->url(); - inspector_agent_->SetParentHandle( - std::unique_ptr(parent_handle)); + inspector_agent_->SetParentHandle(std::move(parent_handle)); } else { inspector_path = argv_.size() > 1 ? argv_[1].c_str() : ""; } diff --git a/src/node_main_instance.cc b/src/node_main_instance.cc index 25bede66edbce8..e82594c212fbdc 100644 --- a/src/node_main_instance.cc +++ b/src/node_main_instance.cc @@ -7,6 +7,10 @@ #include #endif +#if HAVE_INSPECTOR +#include "inspector/worker_inspector.h" // ParentInspectorHandle +#endif + namespace node { using v8::Context; @@ -217,7 +221,7 @@ std::unique_ptr NodeMainInstance::CreateMainEnvironment( // TODO(joyeecheung): when we snapshot the bootstrapped context, // the inspector and diagnostics setup should after after deserialization. #if HAVE_INSPECTOR - *exit_code = env->InitializeInspector(nullptr); + *exit_code = env->InitializeInspector({}); #endif if (*exit_code != 0) { return env; diff --git a/src/node_worker.cc b/src/node_worker.cc index 311aaa8e038c1c..ab442a4a34a8c6 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -251,7 +251,7 @@ void Worker::Run() { { env_->InitializeDiagnostics(); #if HAVE_INSPECTOR - env_->InitializeInspector(inspector_parent_handle_.release()); + env_->InitializeInspector(std::move(inspector_parent_handle_)); #endif HandleScope handle_scope(isolate_); AsyncCallbackScope callback_scope(env_.get());