Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: allow adding linked bindings to Environment #30274

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup! src: allow adding linked bindings to Environment
addaleax committed Nov 6, 2019
commit bd8ed79c1804925415bba5fe8031c1743f28c31b
4 changes: 2 additions & 2 deletions src/api/environment.cc
Original file line number Diff line number Diff line change
@@ -503,9 +503,9 @@ void AddLinkedBinding(Environment* env, const node_module& mod) {
Mutex::ScopedLock lock(env->extra_linked_bindings_mutex());

node_module* prev_head = env->extra_linked_bindings_head();
env->extra_linked_bindings().push_back(mod);
env->extra_linked_bindings()->push_back(mod);
if (prev_head != nullptr)
prev_head->nm_link = &env->extra_linked_bindings().back();
prev_head->nm_link = &env->extra_linked_bindings()->back();
}

void AddLinkedBinding(Environment* env,
6 changes: 3 additions & 3 deletions src/env-inl.h
Original file line number Diff line number Diff line change
@@ -876,16 +876,16 @@ inline bool Environment::is_stopping() const {
return thread_stopper_.is_stopped();
}

inline std::list<node_module>& Environment::extra_linked_bindings() {
return extra_linked_bindings_;
inline std::list<node_module>* Environment::extra_linked_bindings() {
return &extra_linked_bindings_;
}

inline node_module* Environment::extra_linked_bindings_head() {
return extra_linked_bindings_.size() > 0 ?
&extra_linked_bindings_.front() : nullptr;
}

inline Mutex& Environment::extra_linked_bindings_mutex() {
inline const Mutex& Environment::extra_linked_bindings_mutex() const {
return extra_linked_bindings_mutex_;
}

4 changes: 2 additions & 2 deletions src/env.h
Original file line number Diff line number Diff line change
@@ -1088,9 +1088,9 @@ class Environment : public MemoryRetainer {
inline void remove_sub_worker_context(worker::Worker* context);
void stop_sub_worker_contexts();
inline bool is_stopping() const;
inline std::list<node_module>& extra_linked_bindings();
inline std::list<node_module>* extra_linked_bindings();
inline node_module* extra_linked_bindings_head();
inline Mutex& extra_linked_bindings_mutex();
inline const Mutex& extra_linked_bindings_mutex() const;

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