From 277077853fa062f8a101b9af86e62b23168c87ae Mon Sep 17 00:00:00 2001 From: Jon Moss Date: Mon, 9 Jul 2018 11:02:11 -0400 Subject: [PATCH] src: make Environment::is_stopping_worker inline Fixes a TODO comment. PR-URL: https://github.com/nodejs/node/pull/21720 Reviewed-By: Anna Henningsen Reviewed-By: Tiancheng "Timothy" Gu Reviewed-By: James M Snell --- src/env-inl.h | 6 ++++++ src/env.cc | 5 ----- src/env.h | 4 +--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/env-inl.h b/src/env-inl.h index bbb80c6f7ae916..8b878431ac65a3 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -33,6 +33,7 @@ #include "node_perf_common.h" #include "node_context_data.h" #include "tracing/agent.h" +#include "node_worker.h" #include #include @@ -623,6 +624,11 @@ inline void Environment::remove_sub_worker_context(worker::Worker* context) { sub_worker_contexts_.erase(context); } +inline bool Environment::is_stopping_worker() const { + CHECK(!is_main_thread()); + return worker_context_->is_stopped(); +} + inline performance::performance_state* Environment::performance_state() { return performance_state_.get(); } diff --git a/src/env.cc b/src/env.cc index 2236893dd77923..6c906e2fb19c56 100644 --- a/src/env.cc +++ b/src/env.cc @@ -653,9 +653,4 @@ void Environment::stop_sub_worker_contexts() { } } -bool Environment::is_stopping_worker() const { - CHECK(!is_main_thread()); - return worker_context_->is_stopped(); -} - } // namespace node diff --git a/src/env.h b/src/env.h index c7e75004bf0ceb..38be74542b2599 100644 --- a/src/env.h +++ b/src/env.h @@ -723,9 +723,6 @@ class Environment { inline bool can_call_into_js() const; inline void set_can_call_into_js(bool can_call_into_js); - // TODO(addaleax): This should be inline. - bool is_stopping_worker() const; - inline bool is_main_thread() const; inline uint64_t thread_id() const; inline void set_thread_id(uint64_t id); @@ -734,6 +731,7 @@ class Environment { inline void add_sub_worker_context(worker::Worker* context); inline void remove_sub_worker_context(worker::Worker* context); void stop_sub_worker_contexts(); + inline bool is_stopping_worker() const; inline void ThrowError(const char* errmsg); inline void ThrowTypeError(const char* errmsg);