@@ -317,6 +317,19 @@ void FreeIsolateData(IsolateData* isolate_data) {
317317 delete isolate_data;
318318}
319319
320+ InspectorParentHandle::~InspectorParentHandle () {}
321+
322+ // Hide the internal handle class from the public API.
323+ #if HAVE_INSPECTOR
324+ struct InspectorParentHandleImpl : public InspectorParentHandle {
325+ std::unique_ptr<inspector::ParentInspectorHandle> impl;
326+
327+ explicit InspectorParentHandleImpl (
328+ std::unique_ptr<inspector::ParentInspectorHandle>&& impl)
329+ : impl(std::move(impl)) {}
330+ };
331+ #endif
332+
320333Environment* CreateEnvironment (IsolateData* isolate_data,
321334 Local<Context> context,
322335 int argc,
@@ -335,7 +348,8 @@ Environment* CreateEnvironment(
335348 const std::vector<std::string>& args,
336349 const std::vector<std::string>& exec_args,
337350 EnvironmentFlags::Flags flags,
338- ThreadId thread_id) {
351+ ThreadId thread_id,
352+ std::unique_ptr<InspectorParentHandle> inspector_parent_handle) {
339353 Isolate* isolate = context->GetIsolate ();
340354 HandleScope handle_scope (isolate);
341355 Context::Scope context_scope (context);
@@ -352,6 +366,16 @@ Environment* CreateEnvironment(
352366 env->set_abort_on_uncaught_exception (false );
353367 }
354368
369+ #if HAVE_INSPECTOR
370+ if (inspector_parent_handle) {
371+ env->InitializeInspector (
372+ std::move (static_cast <InspectorParentHandleImpl*>(
373+ inspector_parent_handle.get ())->impl ));
374+ } else {
375+ env->InitializeInspector ({});
376+ }
377+ #endif
378+
355379 if (env->RunBootstrapping ().IsEmpty ()) {
356380 FreeEnvironment (env);
357381 return nullptr ;
@@ -381,19 +405,6 @@ void FreeEnvironment(Environment* env) {
381405 delete env;
382406}
383407
384- InspectorParentHandle::~InspectorParentHandle () {}
385-
386- // Hide the internal handle class from the public API.
387- #if HAVE_INSPECTOR
388- struct InspectorParentHandleImpl : public InspectorParentHandle {
389- std::unique_ptr<inspector::ParentInspectorHandle> impl;
390-
391- explicit InspectorParentHandleImpl (
392- std::unique_ptr<inspector::ParentInspectorHandle>&& impl)
393- : impl(std::move(impl)) {}
394- };
395- #endif
396-
397408NODE_EXTERN std::unique_ptr<InspectorParentHandle> GetInspectorParentHandle (
398409 Environment* env,
399410 ThreadId thread_id,
@@ -417,27 +428,17 @@ void LoadEnvironment(Environment* env) {
417428MaybeLocal<Value> LoadEnvironment (
418429 Environment* env,
419430 StartExecutionCallback cb,
420- std::unique_ptr<InspectorParentHandle> inspector_parent_handle ) {
431+ std::unique_ptr<InspectorParentHandle> removeme ) {
421432 env->InitializeLibuv (per_process::v8_is_profiling);
422433 env->InitializeDiagnostics ();
423434
424- #if HAVE_INSPECTOR
425- if (inspector_parent_handle) {
426- env->InitializeInspector (
427- std::move (static_cast <InspectorParentHandleImpl*>(
428- inspector_parent_handle.get ())->impl ));
429- } else {
430- env->InitializeInspector ({});
431- }
432- #endif
433-
434435 return StartExecution (env, cb);
435436}
436437
437438MaybeLocal<Value> LoadEnvironment (
438439 Environment* env,
439440 const char * main_script_source_utf8,
440- std::unique_ptr<InspectorParentHandle> inspector_parent_handle ) {
441+ std::unique_ptr<InspectorParentHandle> removeme ) {
441442 CHECK_NOT_NULL (main_script_source_utf8);
442443 return LoadEnvironment (
443444 env,
@@ -462,8 +463,7 @@ MaybeLocal<Value> LoadEnvironment(
462463 env->process_object (),
463464 env->native_module_require ()};
464465 return ExecuteBootstrapper (env, name.c_str (), ¶ms, &args);
465- },
466- std::move (inspector_parent_handle));
466+ });
467467}
468468
469469Environment* GetCurrentEnvironment (Local<Context> context) {
0 commit comments