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 7e4f29f

Browse filesBrowse files
jasnelltargos
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 1d3a63f commit 7e4f29f
Copy full SHA for 7e4f29f

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;
@@ -1733,32 +1732,6 @@ static Local<Object> GetFeatures(Environment* env) {
17331732
return scope.Escape(obj);
17341733
}
17351734

1736-
1737-
static void DebugPortGetter(Local<Name> property,
1738-
const PropertyCallbackInfo<Value>& info) {
1739-
Environment* env = Environment::GetCurrent(info);
1740-
Mutex::ScopedLock lock(process_mutex);
1741-
int port = env->options()->debug_options->port();
1742-
#if HAVE_INSPECTOR
1743-
if (port == 0) {
1744-
if (auto io = env->inspector_agent()->io())
1745-
port = io->port();
1746-
}
1747-
#endif // HAVE_INSPECTOR
1748-
info.GetReturnValue().Set(port);
1749-
}
1750-
1751-
1752-
static void DebugPortSetter(Local<Name> property,
1753-
Local<Value> value,
1754-
const PropertyCallbackInfo<void>& info) {
1755-
Environment* env = Environment::GetCurrent(info);
1756-
Mutex::ScopedLock lock(process_mutex);
1757-
env->options()->debug_options->host_port.port =
1758-
value->Int32Value(env->context()).FromMaybe(0);
1759-
}
1760-
1761-
17621735
static void DebugProcess(const FunctionCallbackInfo<Value>& args);
17631736
static void DebugEnd(const FunctionCallbackInfo<Value>& args);
17641737

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
@@ -910,6 +910,11 @@ void EnvSetter(v8::Local<v8::Name> property,
910910
void EnvQuery(v8::Local<v8::Name> property,
911911
const v8::PropertyCallbackInfo<v8::Integer>& info);
912912
void EnvEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info);
913+
void DebugPortGetter(v8::Local<v8::Name> property,
914+
const v8::PropertyCallbackInfo<v8::Value>& info);
915+
void DebugPortSetter(v8::Local<v8::Name> property,
916+
v8::Local<v8::Value> value,
917+
const v8::PropertyCallbackInfo<void>& info);
913918

914919
void GetParentProcessId(v8::Local<v8::Name> property,
915920
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

@@ -833,4 +837,29 @@ void GetActiveHandles(const FunctionCallbackInfo<Value>& args) {
833837
args.GetReturnValue().Set(ary);
834838
}
835839

840+
void DebugPortGetter(Local<Name> property,
841+
const PropertyCallbackInfo<Value>& info) {
842+
Environment* env = Environment::GetCurrent(info);
843+
Mutex::ScopedLock lock(process_mutex);
844+
int port = env->options()->debug_options->port();
845+
#if HAVE_INSPECTOR
846+
if (port == 0) {
847+
if (auto io = env->inspector_agent()->io())
848+
port = io->port();
849+
}
850+
#endif // HAVE_INSPECTOR
851+
info.GetReturnValue().Set(port);
852+
}
853+
854+
855+
void DebugPortSetter(Local<Name> property,
856+
Local<Value> value,
857+
const PropertyCallbackInfo<void>& info) {
858+
Environment* env = Environment::GetCurrent(info);
859+
Mutex::ScopedLock lock(process_mutex);
860+
env->options()->debug_options->host_port.port =
861+
value->Int32Value(env->context()).FromMaybe(0);
862+
}
863+
864+
836865
} // namespace node

0 commit comments

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