Skip to content

Commit fcfd3e1

Browse files
committed
src: make Environment::is_stopping_worker inline
Fixes a TODO comment. PR-URL: #21720 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 8174d0c commit fcfd3e1

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

src/env-inl.h

+6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "node_perf_common.h"
3434
#include "node_context_data.h"
3535
#include "tracing/agent.h"
36+
#include "node_worker.h"
3637

3738
#include <stddef.h>
3839
#include <stdint.h>
@@ -623,6 +624,11 @@ inline void Environment::remove_sub_worker_context(worker::Worker* context) {
623624
sub_worker_contexts_.erase(context);
624625
}
625626

627+
inline bool Environment::is_stopping_worker() const {
628+
CHECK(!is_main_thread());
629+
return worker_context_->is_stopped();
630+
}
631+
626632
inline performance::performance_state* Environment::performance_state() {
627633
return performance_state_.get();
628634
}

src/env.cc

-5
Original file line numberDiff line numberDiff line change
@@ -734,9 +734,4 @@ void Environment::stop_sub_worker_contexts() {
734734
}
735735
}
736736

737-
bool Environment::is_stopping_worker() const {
738-
CHECK(!is_main_thread());
739-
return worker_context_->is_stopped();
740-
}
741-
742737
} // namespace node

src/env.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -723,9 +723,6 @@ class Environment {
723723
inline bool can_call_into_js() const;
724724
inline void set_can_call_into_js(bool can_call_into_js);
725725

726-
// TODO(addaleax): This should be inline.
727-
bool is_stopping_worker() const;
728-
729726
inline bool is_main_thread() const;
730727
inline uint64_t thread_id() const;
731728
inline void set_thread_id(uint64_t id);
@@ -734,6 +731,7 @@ class Environment {
734731
inline void add_sub_worker_context(worker::Worker* context);
735732
inline void remove_sub_worker_context(worker::Worker* context);
736733
void stop_sub_worker_contexts();
734+
inline bool is_stopping_worker() const;
737735

738736
inline void ThrowError(const char* errmsg);
739737
inline void ThrowTypeError(const char* errmsg);

0 commit comments

Comments
 (0)