|
27 | 27 | #include "node_internals.h"
|
28 | 28 | #include "node_metadata.h"
|
29 | 29 | #include "node_native_module.h"
|
| 30 | +#include "node_options-inl.h" |
30 | 31 | #include "node_perf.h"
|
31 | 32 | #include "node_platform.h"
|
32 | 33 | #include "node_revert.h"
|
@@ -257,13 +258,15 @@ static struct {
|
257 | 258 | }
|
258 | 259 |
|
259 | 260 | #if HAVE_INSPECTOR
|
260 |
| - bool StartInspector(Environment* env, const char* script_path, |
261 |
| - std::shared_ptr<DebugOptions> options) { |
| 261 | + bool StartInspector(Environment* env, const char* script_path) { |
262 | 262 | // Inspector agent can't fail to start, but if it was configured to listen
|
263 | 263 | // right away on the websocket port and fails to bind/etc, this will return
|
264 | 264 | // false.
|
265 | 265 | return env->inspector_agent()->Start(
|
266 |
| - script_path == nullptr ? "" : script_path, options, true); |
| 266 | + script_path == nullptr ? "" : script_path, |
| 267 | + env->options()->debug_options(), |
| 268 | + env->inspector_host_port(), |
| 269 | + true); |
267 | 270 | }
|
268 | 271 |
|
269 | 272 | bool InspectorStarted(Environment* env) {
|
@@ -304,8 +307,7 @@ static struct {
|
304 | 307 | void Dispose() {}
|
305 | 308 | void DrainVMTasks(Isolate* isolate) {}
|
306 | 309 | void CancelVMTasks(Isolate* isolate) {}
|
307 |
| - bool StartInspector(Environment* env, const char* script_path, |
308 |
| - const DebugOptions& options) { |
| 310 | + bool StartInspector(Environment* env, const char* script_path) { |
309 | 311 | env->ThrowError("Node compiled with NODE_USE_V8_PLATFORM=0");
|
310 | 312 | return true;
|
311 | 313 | }
|
@@ -1090,24 +1092,24 @@ void SetupProcessObject(Environment* env,
|
1090 | 1092 |
|
1091 | 1093 | // TODO(refack): move the following 4 to `node_config`
|
1092 | 1094 | // --inspect-brk
|
1093 |
| - if (env->options()->debug_options->wait_for_connect()) { |
| 1095 | + if (env->options()->debug_options().wait_for_connect()) { |
1094 | 1096 | READONLY_DONT_ENUM_PROPERTY(process,
|
1095 | 1097 | "_breakFirstLine", True(env->isolate()));
|
1096 | 1098 | }
|
1097 | 1099 |
|
1098 |
| - if (env->options()->debug_options->break_node_first_line) { |
| 1100 | + if (env->options()->debug_options().break_node_first_line) { |
1099 | 1101 | READONLY_DONT_ENUM_PROPERTY(process,
|
1100 | 1102 | "_breakNodeFirstLine", True(env->isolate()));
|
1101 | 1103 | }
|
1102 | 1104 |
|
1103 | 1105 | // --inspect --debug-brk
|
1104 |
| - if (env->options()->debug_options->deprecated_invocation()) { |
| 1106 | + if (env->options()->debug_options().deprecated_invocation()) { |
1105 | 1107 | READONLY_DONT_ENUM_PROPERTY(process,
|
1106 | 1108 | "_deprecatedDebugBrk", True(env->isolate()));
|
1107 | 1109 | }
|
1108 | 1110 |
|
1109 | 1111 | // --debug or, --debug-brk without --inspect
|
1110 |
| - if (env->options()->debug_options->invalid_invocation()) { |
| 1112 | + if (env->options()->debug_options().invalid_invocation()) { |
1111 | 1113 | READONLY_DONT_ENUM_PROPERTY(process,
|
1112 | 1114 | "_invalidDebug", True(env->isolate()));
|
1113 | 1115 | }
|
@@ -1255,7 +1257,7 @@ void LoadEnvironment(Environment* env) {
|
1255 | 1257 | ->GetFunction(context)
|
1256 | 1258 | .ToLocalChecked(),
|
1257 | 1259 | Boolean::New(isolate,
|
1258 |
| - env->options()->debug_options->break_node_first_line)}; |
| 1260 | + env->options()->debug_options().break_node_first_line)}; |
1259 | 1261 |
|
1260 | 1262 | MaybeLocal<Value> loader_exports;
|
1261 | 1263 | // Bootstrap internal loaders
|
@@ -1290,12 +1292,10 @@ void LoadEnvironment(Environment* env) {
|
1290 | 1292 | }
|
1291 | 1293 | }
|
1292 | 1294 |
|
1293 |
| - |
1294 |
| -static void StartInspector(Environment* env, const char* path, |
1295 |
| - std::shared_ptr<DebugOptions> debug_options) { |
| 1295 | +static void StartInspector(Environment* env, const char* path) { |
1296 | 1296 | #if HAVE_INSPECTOR
|
1297 | 1297 | CHECK(!env->inspector_agent()->IsListening());
|
1298 |
| - v8_platform.StartInspector(env, path, debug_options); |
| 1298 | + v8_platform.StartInspector(env, path); |
1299 | 1299 | #endif // HAVE_INSPECTOR
|
1300 | 1300 | }
|
1301 | 1301 |
|
@@ -1938,9 +1938,9 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data,
|
1938 | 1938 | env.Start(args, exec_args, v8_is_profiling);
|
1939 | 1939 |
|
1940 | 1940 | const char* path = args.size() > 1 ? args[1].c_str() : nullptr;
|
1941 |
| - StartInspector(&env, path, env.options()->debug_options); |
| 1941 | + StartInspector(&env, path); |
1942 | 1942 |
|
1943 |
| - if (env.options()->debug_options->inspector_enabled && |
| 1943 | + if (env.options()->debug_options().inspector_enabled && |
1944 | 1944 | !v8_platform.InspectorStarted(&env)) {
|
1945 | 1945 | return 12; // Signal internal error.
|
1946 | 1946 | }
|
|
0 commit comments