diff --git a/src/node.cc b/src/node.cc index a94ac07591ab0e..0f380efdcaf438 100644 --- a/src/node.cc +++ b/src/node.cc @@ -160,7 +160,6 @@ using v8::Object; using v8::ObjectTemplate; using v8::Promise; using v8::PropertyAttribute; -using v8::PropertyCallbackInfo; using v8::ReadOnly; using v8::Script; using v8::ScriptCompiler; @@ -1733,32 +1732,6 @@ static Local GetFeatures(Environment* env) { return scope.Escape(obj); } - -static void DebugPortGetter(Local property, - const PropertyCallbackInfo& info) { - Environment* env = Environment::GetCurrent(info); - Mutex::ScopedLock lock(process_mutex); - int port = env->options()->debug_options->port(); -#if HAVE_INSPECTOR - if (port == 0) { - if (auto io = env->inspector_agent()->io()) - port = io->port(); - } -#endif // HAVE_INSPECTOR - info.GetReturnValue().Set(port); -} - - -static void DebugPortSetter(Local property, - Local value, - const PropertyCallbackInfo& info) { - Environment* env = Environment::GetCurrent(info); - Mutex::ScopedLock lock(process_mutex); - env->options()->debug_options->host_port.port = - value->Int32Value(env->context()).FromMaybe(0); -} - - static void DebugProcess(const FunctionCallbackInfo& args); static void DebugEnd(const FunctionCallbackInfo& args); diff --git a/src/node_internals.h b/src/node_internals.h index 4c5dc88a0e7b05..2f2473f28572ae 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -910,6 +910,11 @@ void EnvSetter(v8::Local property, void EnvQuery(v8::Local property, const v8::PropertyCallbackInfo& info); void EnvEnumerator(const v8::PropertyCallbackInfo& info); +void DebugPortGetter(v8::Local property, + const v8::PropertyCallbackInfo& info); +void DebugPortSetter(v8::Local property, + v8::Local value, + const v8::PropertyCallbackInfo& info); void GetParentProcessId(v8::Local property, const v8::PropertyCallbackInfo& info); diff --git a/src/node_process.cc b/src/node_process.cc index 1990228785280b..f6a5424f56547b 100644 --- a/src/node_process.cc +++ b/src/node_process.cc @@ -7,6 +7,10 @@ #include "uv.h" #include "v8.h" +#if HAVE_INSPECTOR +#include "inspector_io.h" +#endif + #include // PATH_MAX #include @@ -833,4 +837,29 @@ void GetActiveHandles(const FunctionCallbackInfo& args) { args.GetReturnValue().Set(ary); } +void DebugPortGetter(Local property, + const PropertyCallbackInfo& info) { + Environment* env = Environment::GetCurrent(info); + Mutex::ScopedLock lock(process_mutex); + int port = env->options()->debug_options->port(); +#if HAVE_INSPECTOR + if (port == 0) { + if (auto io = env->inspector_agent()->io()) + port = io->port(); + } +#endif // HAVE_INSPECTOR + info.GetReturnValue().Set(port); +} + + +void DebugPortSetter(Local property, + Local value, + const PropertyCallbackInfo& info) { + Environment* env = Environment::GetCurrent(info); + Mutex::ScopedLock lock(process_mutex); + env->options()->debug_options->host_port.port = + value->Int32Value(env->context()).FromMaybe(0); +} + + } // namespace node