diff options
-rw-r--r-- | src/node.cc | 27 | ||||
-rw-r--r-- | src/node_internals.h | 5 | ||||
-rw-r--r-- | src/node_process.cc | 29 |
3 files changed, 34 insertions, 27 deletions
diff --git a/src/node.cc b/src/node.cc index ed4da64425..6baf2222e8 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; @@ -1672,32 +1671,6 @@ static Local<Object> GetFeatures(Environment* env) { return scope.Escape(obj); } - -static void DebugPortGetter(Local<Name> property, - const PropertyCallbackInfo<Value>& 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<Name> property, - Local<Value> value, - const PropertyCallbackInfo<void>& 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<Value>& args); static void DebugEnd(const FunctionCallbackInfo<Value>& args); diff --git a/src/node_internals.h b/src/node_internals.h index 8ab79a1267..c7a4299c89 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -905,6 +905,11 @@ void EnvSetter(v8::Local<v8::Name> property, void EnvQuery(v8::Local<v8::Name> property, const v8::PropertyCallbackInfo<v8::Integer>& info); void EnvEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info); +void DebugPortGetter(v8::Local<v8::Name> property, + const v8::PropertyCallbackInfo<v8::Value>& info); +void DebugPortSetter(v8::Local<v8::Name> property, + v8::Local<v8::Value> value, + const v8::PropertyCallbackInfo<void>& info); void GetParentProcessId(v8::Local<v8::Name> property, const v8::PropertyCallbackInfo<v8::Value>& info); diff --git a/src/node_process.cc b/src/node_process.cc index 19596f0cfd..c223b482cf 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 <limits.h> // PATH_MAX #include <stdio.h> @@ -842,4 +846,29 @@ void GetActiveHandles(const FunctionCallbackInfo<Value>& args) { args.GetReturnValue().Set(ary); } +void DebugPortGetter(Local<Name> property, + const PropertyCallbackInfo<Value>& 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<Name> property, + Local<Value> value, + const PropertyCallbackInfo<void>& 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 |