Skip to content

Commit 2770778

Browse files
maclover7targos
authored andcommittedJul 12, 2018
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 6920091 commit 2770778

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
@@ -653,9 +653,4 @@ void Environment::stop_sub_worker_contexts() {
653653
}
654654
}
655655

656-
bool Environment::is_stopping_worker() const {
657-
CHECK(!is_main_thread());
658-
return worker_context_->is_stopped();
659-
}
660-
661656
} // 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)
Please sign in to comment.