|
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"
|
@@ -259,13 +260,15 @@ static struct {
|
259 | 260 | }
|
260 | 261 |
|
261 | 262 | #if HAVE_INSPECTOR
|
262 |
| - bool StartInspector(Environment* env, const char* script_path, |
263 |
| - std::shared_ptr<DebugOptions> options) { |
| 263 | + bool StartInspector(Environment* env, const char* script_path) { |
264 | 264 | // Inspector agent can't fail to start, but if it was configured to listen
|
265 | 265 | // right away on the websocket port and fails to bind/etc, this will return
|
266 | 266 | // false.
|
267 | 267 | return env->inspector_agent()->Start(
|
268 |
| - script_path == nullptr ? "" : script_path, options, true); |
| 268 | + script_path == nullptr ? "" : script_path, |
| 269 | + env->options()->debug_options(), |
| 270 | + env->inspector_host_port(), |
| 271 | + true); |
269 | 272 | }
|
270 | 273 |
|
271 | 274 | bool InspectorStarted(Environment* env) {
|
@@ -306,8 +309,7 @@ static struct {
|
306 | 309 | void Dispose() {}
|
307 | 310 | void DrainVMTasks(Isolate* isolate) {}
|
308 | 311 | void CancelVMTasks(Isolate* isolate) {}
|
309 |
| - bool StartInspector(Environment* env, const char* script_path, |
310 |
| - const DebugOptions& options) { |
| 312 | + bool StartInspector(Environment* env, const char* script_path) { |
311 | 313 | env->ThrowError("Node compiled with NODE_USE_V8_PLATFORM=0");
|
312 | 314 | return true;
|
313 | 315 | }
|
@@ -1127,24 +1129,24 @@ void SetupProcessObject(Environment* env,
|
1127 | 1129 |
|
1128 | 1130 | // TODO(refack): move the following 4 to `node_config`
|
1129 | 1131 | // --inspect-brk
|
1130 |
| - if (env->options()->debug_options->wait_for_connect()) { |
| 1132 | + if (env->options()->debug_options().wait_for_connect()) { |
1131 | 1133 | READONLY_DONT_ENUM_PROPERTY(process,
|
1132 | 1134 | "_breakFirstLine", True(env->isolate()));
|
1133 | 1135 | }
|
1134 | 1136 |
|
1135 |
| - if (env->options()->debug_options->break_node_first_line) { |
| 1137 | + if (env->options()->debug_options().break_node_first_line) { |
1136 | 1138 | READONLY_DONT_ENUM_PROPERTY(process,
|
1137 | 1139 | "_breakNodeFirstLine", True(env->isolate()));
|
1138 | 1140 | }
|
1139 | 1141 |
|
1140 | 1142 | // --inspect --debug-brk
|
1141 |
| - if (env->options()->debug_options->deprecated_invocation()) { |
| 1143 | + if (env->options()->debug_options().deprecated_invocation()) { |
1142 | 1144 | READONLY_DONT_ENUM_PROPERTY(process,
|
1143 | 1145 | "_deprecatedDebugBrk", True(env->isolate()));
|
1144 | 1146 | }
|
1145 | 1147 |
|
1146 | 1148 | // --debug or, --debug-brk without --inspect
|
1147 |
| - if (env->options()->debug_options->invalid_invocation()) { |
| 1149 | + if (env->options()->debug_options().invalid_invocation()) { |
1148 | 1150 | READONLY_DONT_ENUM_PROPERTY(process,
|
1149 | 1151 | "_invalidDebug", True(env->isolate()));
|
1150 | 1152 | }
|
@@ -1356,7 +1358,7 @@ void LoadEnvironment(Environment* env) {
|
1356 | 1358 | get_linked_binding_fn,
|
1357 | 1359 | get_internal_binding_fn,
|
1358 | 1360 | Boolean::New(env->isolate(),
|
1359 |
| - env->options()->debug_options->break_node_first_line) |
| 1361 | + env->options()->debug_options().break_node_first_line) |
1360 | 1362 | };
|
1361 | 1363 |
|
1362 | 1364 | // Bootstrap internal loaders
|
@@ -1390,12 +1392,10 @@ void LoadEnvironment(Environment* env) {
|
1390 | 1392 | }
|
1391 | 1393 | }
|
1392 | 1394 |
|
1393 |
| - |
1394 |
| -static void StartInspector(Environment* env, const char* path, |
1395 |
| - std::shared_ptr<DebugOptions> debug_options) { |
| 1395 | +static void StartInspector(Environment* env, const char* path) { |
1396 | 1396 | #if HAVE_INSPECTOR
|
1397 | 1397 | CHECK(!env->inspector_agent()->IsListening());
|
1398 |
| - v8_platform.StartInspector(env, path, debug_options); |
| 1398 | + v8_platform.StartInspector(env, path); |
1399 | 1399 | #endif // HAVE_INSPECTOR
|
1400 | 1400 | }
|
1401 | 1401 |
|
@@ -2038,9 +2038,9 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data,
|
2038 | 2038 | env.Start(args, exec_args, v8_is_profiling);
|
2039 | 2039 |
|
2040 | 2040 | const char* path = args.size() > 1 ? args[1].c_str() : nullptr;
|
2041 |
| - StartInspector(&env, path, env.options()->debug_options); |
| 2041 | + StartInspector(&env, path); |
2042 | 2042 |
|
2043 |
| - if (env.options()->debug_options->inspector_enabled && |
| 2043 | + if (env.options()->debug_options().inspector_enabled && |
2044 | 2044 | !v8_platform.InspectorStarted(&env)) {
|
2045 | 2045 | return 12; // Signal internal error.
|
2046 | 2046 | }
|
|
0 commit comments