@@ -330,6 +330,19 @@ void FreeIsolateData(IsolateData* isolate_data) {
330330 delete isolate_data;
331331}
332332
333+ InspectorParentHandle::~InspectorParentHandle () {}
334+
335+ // Hide the internal handle class from the public API.
336+ #if HAVE_INSPECTOR
337+ struct InspectorParentHandleImpl : public InspectorParentHandle {
338+ std::unique_ptr<inspector::ParentInspectorHandle> impl;
339+
340+ explicit InspectorParentHandleImpl (
341+ std::unique_ptr<inspector::ParentInspectorHandle>&& impl)
342+ : impl(std::move(impl)) {}
343+ };
344+ #endif
345+
333346Environment* CreateEnvironment (IsolateData* isolate_data,
334347 Local<Context> context,
335348 int argc,
@@ -348,7 +361,8 @@ Environment* CreateEnvironment(
348361 const std::vector<std::string>& args,
349362 const std::vector<std::string>& exec_args,
350363 EnvironmentFlags::Flags flags,
351- ThreadId thread_id) {
364+ ThreadId thread_id,
365+ std::unique_ptr<InspectorParentHandle> inspector_parent_handle) {
352366 Isolate* isolate = context->GetIsolate ();
353367 HandleScope handle_scope (isolate);
354368 Context::Scope context_scope (context);
@@ -365,6 +379,16 @@ Environment* CreateEnvironment(
365379 env->set_abort_on_uncaught_exception (false );
366380 }
367381
382+ #if HAVE_INSPECTOR
383+ if (inspector_parent_handle) {
384+ env->InitializeInspector (
385+ std::move (static_cast <InspectorParentHandleImpl*>(
386+ inspector_parent_handle.get ())->impl ));
387+ } else {
388+ env->InitializeInspector ({});
389+ }
390+ #endif
391+
368392 if (env->RunBootstrapping ().IsEmpty ()) {
369393 FreeEnvironment (env);
370394 return nullptr ;
@@ -394,19 +418,6 @@ void FreeEnvironment(Environment* env) {
394418 delete env;
395419}
396420
397- InspectorParentHandle::~InspectorParentHandle () {}
398-
399- // Hide the internal handle class from the public API.
400- #if HAVE_INSPECTOR
401- struct InspectorParentHandleImpl : public InspectorParentHandle {
402- std::unique_ptr<inspector::ParentInspectorHandle> impl;
403-
404- explicit InspectorParentHandleImpl (
405- std::unique_ptr<inspector::ParentInspectorHandle>&& impl)
406- : impl(std::move(impl)) {}
407- };
408- #endif
409-
410421NODE_EXTERN std::unique_ptr<InspectorParentHandle> GetInspectorParentHandle (
411422 Environment* env,
412423 ThreadId thread_id,
@@ -430,27 +441,17 @@ void LoadEnvironment(Environment* env) {
430441MaybeLocal<Value> LoadEnvironment (
431442 Environment* env,
432443 StartExecutionCallback cb,
433- std::unique_ptr<InspectorParentHandle> inspector_parent_handle ) {
444+ std::unique_ptr<InspectorParentHandle> removeme ) {
434445 env->InitializeLibuv (per_process::v8_is_profiling);
435446 env->InitializeDiagnostics ();
436447
437- #if HAVE_INSPECTOR
438- if (inspector_parent_handle) {
439- env->InitializeInspector (
440- std::move (static_cast <InspectorParentHandleImpl*>(
441- inspector_parent_handle.get ())->impl ));
442- } else {
443- env->InitializeInspector ({});
444- }
445- #endif
446-
447448 return StartExecution (env, cb);
448449}
449450
450451MaybeLocal<Value> LoadEnvironment (
451452 Environment* env,
452453 const char * main_script_source_utf8,
453- std::unique_ptr<InspectorParentHandle> inspector_parent_handle ) {
454+ std::unique_ptr<InspectorParentHandle> removeme ) {
454455 CHECK_NOT_NULL (main_script_source_utf8);
455456 return LoadEnvironment (
456457 env,
@@ -475,8 +476,7 @@ MaybeLocal<Value> LoadEnvironment(
475476 env->process_object (),
476477 env->native_module_require ()};
477478 return ExecuteBootstrapper (env, name.c_str (), ¶ms, &args);
478- },
479- std::move (inspector_parent_handle));
479+ });
480480}
481481
482482Environment* GetCurrentEnvironment (Local<Context> context) {
0 commit comments