@@ -262,23 +262,6 @@ static struct {
262262 platform_->CancelPendingDelayedTasks (isolate);
263263 }
264264
265- #if HAVE_INSPECTOR
266- bool StartInspector (Environment* env, const char * script_path) {
267- // Inspector agent can't fail to start, but if it was configured to listen
268- // right away on the websocket port and fails to bind/etc, this will return
269- // false.
270- return env->inspector_agent ()->Start (
271- script_path == nullptr ? " " : script_path,
272- env->options ()->debug_options (),
273- env->inspector_host_port (),
274- true );
275- }
276-
277- bool InspectorStarted (Environment* env) {
278- return env->inspector_agent ()->IsListening ();
279- }
280- #endif // HAVE_INSPECTOR
281-
282265 void StartTracingAgent () {
283266 if (per_process::cli_options->trace_event_categories .empty ()) {
284267 tracing_file_writer_ = tracing_agent_->DefaultHandle ();
@@ -317,10 +300,6 @@ static struct {
317300 void Dispose () {}
318301 void DrainVMTasks (Isolate* isolate) {}
319302 void CancelVMTasks (Isolate* isolate) {}
320- bool StartInspector (Environment* env, const char * script_path) {
321- env->ThrowError (" Node compiled with NODE_USE_V8_PLATFORM=0" );
322- return true ;
323- }
324303
325304 void StartTracingAgent () {
326305 if (!trace_enabled_categories.empty ()) {
@@ -338,12 +317,6 @@ static struct {
338317 return nullptr ;
339318 }
340319#endif // !NODE_USE_V8_PLATFORM
341-
342- #if !NODE_USE_V8_PLATFORM || !HAVE_INSPECTOR
343- bool InspectorStarted (Environment* env) {
344- return false ;
345- }
346- #endif // !NODE_USE_V8_PLATFORM || !HAVE_INSPECTOR
347320} v8_platform;
348321
349322tracing::AgentWriterHandle* GetTracingAgentWriter () {
@@ -774,13 +747,6 @@ void StartExecution(Environment* env, const char* main_script_id) {
774747 env->context (), Undefined (env->isolate ()), arraysize (argv), argv));
775748}
776749
777- static void StartInspector (Environment* env, const char * path) {
778- #if HAVE_INSPECTOR
779- CHECK (!env->inspector_agent ()->IsListening ());
780- v8_platform.StartInspector (env, path);
781- #endif // HAVE_INSPECTOR
782- }
783-
784750
785751#ifdef __POSIX__
786752void RegisterSignalHandler (int signal,
@@ -1280,13 +1246,24 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data,
12801246 Environment env (isolate_data, context);
12811247 env.Start (args, exec_args, per_process::v8_is_profiling);
12821248
1283- const char * path = args.size () > 1 ? args[1 ].c_str () : nullptr ;
1284- StartInspector (&env, path);
1285-
1249+ #if HAVE_INSPECTOR && NODE_USE_V8_PLATFORM
1250+ CHECK (!env.inspector_agent ()->IsListening ());
1251+ // Inspector agent can't fail to start, but if it was configured to listen
1252+ // right away on the websocket port and fails to bind/etc, this will return
1253+ // false.
1254+ env.inspector_agent ()->Start (args.size () > 1 ? args[1 ].c_str () : " " ,
1255+ env.options ()->debug_options (),
1256+ env.inspector_host_port (),
1257+ true );
12861258 if (env.options ()->debug_options ().inspector_enabled &&
1287- !v8_platform. InspectorStarted (&env )) {
1259+ !env. inspector_agent ()-> IsListening ( )) {
12881260 return 12 ; // Signal internal error.
12891261 }
1262+ #else
1263+ // inspector_enabled can't be true if !HAVE_INSPECTOR or !NODE_USE_V8_PLATFORM
1264+ // - the option parser should not allow that.
1265+ CHECK (!env.options ()->debug_options ().inspector_enabled );
1266+ #endif // HAVE_INSPECTOR && NODE_USE_V8_PLATFORM
12901267
12911268 {
12921269 Environment::AsyncCallbackScope callback_scope (&env);
0 commit comments