diff --git a/src/api/environment.cc b/src/api/environment.cc index 23bae50d6da7ab..5afb5420fc0895 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc @@ -345,8 +345,7 @@ Environment* CreateEnvironment(IsolateData* isolate_data, context, args, exec_args, - static_cast(Environment::kIsMainThread | - Environment::kOwnsProcessState | + static_cast(Environment::kOwnsProcessState | Environment::kOwnsInspector)); env->InitializeLibuv(per_process::v8_is_profiling); if (env->RunBootstrapping().IsEmpty()) { diff --git a/src/env-inl.h b/src/env-inl.h index 3969969a970f62..b0af5bfcbdc473 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -889,7 +889,7 @@ inline void Environment::set_has_serialized_options(bool value) { } inline bool Environment::is_main_thread() const { - return flags_ & kIsMainThread; + return worker_context() == nullptr; } inline bool Environment::owns_process_state() const { diff --git a/src/env.h b/src/env.h index 0007142232a2d0..e4ce0599089a5f 100644 --- a/src/env.h +++ b/src/env.h @@ -859,7 +859,6 @@ class Environment : public MemoryRetainer { enum Flags { kNoFlags = 0, - kIsMainThread = 1 << 0, kOwnsProcessState = 1 << 1, kOwnsInspector = 1 << 2, }; diff --git a/src/node_main_instance.cc b/src/node_main_instance.cc index 831ba528284a52..643041571fb5f3 100644 --- a/src/node_main_instance.cc +++ b/src/node_main_instance.cc @@ -207,8 +207,7 @@ NodeMainInstance::CreateMainEnvironment(int* exit_code) { context, args_, exec_args_, - static_cast(Environment::kIsMainThread | - Environment::kOwnsProcessState | + static_cast(Environment::kOwnsProcessState | Environment::kOwnsInspector)) }; env->InitializeLibuv(per_process::v8_is_profiling); env->InitializeDiagnostics();