Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit eaaee92

Browse filesBrowse files
jasnelladdaleax
authored andcommitted
src: move DebugPortGetter/Setter to node_process.cc
PR-URL: #22758 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Refael Ackermann <refack@gmail.com>
1 parent efd4796 commit eaaee92
Copy full SHA for eaaee92

File tree

Expand file treeCollapse file tree

3 files changed

+34
-27
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+34
-27
lines changed
Open diff view settings
Collapse file

‎src/node.cc‎

Copy file name to clipboardExpand all lines: src/node.cc
-27Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ using v8::Object;
160160
using v8::ObjectTemplate;
161161
using v8::Promise;
162162
using v8::PropertyAttribute;
163-
using v8::PropertyCallbackInfo;
164163
using v8::ReadOnly;
165164
using v8::Script;
166165
using v8::ScriptCompiler;
@@ -1672,32 +1671,6 @@ static Local<Object> GetFeatures(Environment* env) {
16721671
return scope.Escape(obj);
16731672
}
16741673

1675-
1676-
static void DebugPortGetter(Local<Name> property,
1677-
const PropertyCallbackInfo<Value>& info) {
1678-
Environment* env = Environment::GetCurrent(info);
1679-
Mutex::ScopedLock lock(process_mutex);
1680-
int port = env->options()->debug_options->port();
1681-
#if HAVE_INSPECTOR
1682-
if (port == 0) {
1683-
if (auto io = env->inspector_agent()->io())
1684-
port = io->port();
1685-
}
1686-
#endif // HAVE_INSPECTOR
1687-
info.GetReturnValue().Set(port);
1688-
}
1689-
1690-
1691-
static void DebugPortSetter(Local<Name> property,
1692-
Local<Value> value,
1693-
const PropertyCallbackInfo<void>& info) {
1694-
Environment* env = Environment::GetCurrent(info);
1695-
Mutex::ScopedLock lock(process_mutex);
1696-
env->options()->debug_options->host_port.port =
1697-
value->Int32Value(env->context()).FromMaybe(0);
1698-
}
1699-
1700-
17011674
static void DebugProcess(const FunctionCallbackInfo<Value>& args);
17021675
static void DebugEnd(const FunctionCallbackInfo<Value>& args);
17031676

Collapse file

‎src/node_internals.h‎

Copy file name to clipboardExpand all lines: src/node_internals.h
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,11 @@ void EnvSetter(v8::Local<v8::Name> property,
905905
void EnvQuery(v8::Local<v8::Name> property,
906906
const v8::PropertyCallbackInfo<v8::Integer>& info);
907907
void EnvEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info);
908+
void DebugPortGetter(v8::Local<v8::Name> property,
909+
const v8::PropertyCallbackInfo<v8::Value>& info);
910+
void DebugPortSetter(v8::Local<v8::Name> property,
911+
v8::Local<v8::Value> value,
912+
const v8::PropertyCallbackInfo<void>& info);
908913

909914
void GetParentProcessId(v8::Local<v8::Name> property,
910915
const v8::PropertyCallbackInfo<v8::Value>& info);
Collapse file

‎src/node_process.cc‎

Copy file name to clipboardExpand all lines: src/node_process.cc
+29Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
#include "uv.h"
88
#include "v8.h"
99

10+
#if HAVE_INSPECTOR
11+
#include "inspector_io.h"
12+
#endif
13+
1014
#include <limits.h> // PATH_MAX
1115
#include <stdio.h>
1216

@@ -842,4 +846,29 @@ void GetActiveHandles(const FunctionCallbackInfo<Value>& args) {
842846
args.GetReturnValue().Set(ary);
843847
}
844848

849+
void DebugPortGetter(Local<Name> property,
850+
const PropertyCallbackInfo<Value>& info) {
851+
Environment* env = Environment::GetCurrent(info);
852+
Mutex::ScopedLock lock(process_mutex);
853+
int port = env->options()->debug_options->port();
854+
#if HAVE_INSPECTOR
855+
if (port == 0) {
856+
if (auto io = env->inspector_agent()->io())
857+
port = io->port();
858+
}
859+
#endif // HAVE_INSPECTOR
860+
info.GetReturnValue().Set(port);
861+
}
862+
863+
864+
void DebugPortSetter(Local<Name> property,
865+
Local<Value> value,
866+
const PropertyCallbackInfo<void>& info) {
867+
Environment* env = Environment::GetCurrent(info);
868+
Mutex::ScopedLock lock(process_mutex);
869+
env->options()->debug_options->host_port.port =
870+
value->Int32Value(env->context()).FromMaybe(0);
871+
}
872+
873+
845874
} // namespace node

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.