From e460e14d57869c37b181f1e4839c70d8fa89ffb3 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Tue, 5 Nov 2019 22:50:24 +0100 Subject: src: allow adding linked bindings to Environment This allows manually adding linked bindings to an `Environment` instance, without having to register modules at program load in a global namespace. PR-URL: https://github.com/nodejs/node/pull/30274 Reviewed-By: Gireesh Punathil Reviewed-By: Ben Noordhuis --- src/env.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/env.h') diff --git a/src/env.h b/src/env.h index e5490c0a5b..3e3aacc8f7 100644 --- a/src/env.h +++ b/src/env.h @@ -1069,11 +1069,15 @@ class Environment : public MemoryRetainer { inline bool owns_inspector() const; inline uint64_t thread_id() const; inline worker::Worker* worker_context() const; + Environment* worker_parent_env() const; inline void set_worker_context(worker::Worker* context); 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() const; + inline std::list* extra_linked_bindings(); + inline node_module* extra_linked_bindings_head(); + inline const Mutex& extra_linked_bindings_mutex() const; inline void ThrowError(const char* errmsg); inline void ThrowTypeError(const char* errmsg); @@ -1369,6 +1373,9 @@ class Environment : public MemoryRetainer { worker::Worker* worker_context_ = nullptr; + std::list extra_linked_bindings_; + Mutex extra_linked_bindings_mutex_; + static void RunTimers(uv_timer_t* handle); struct ExitCallback { -- cgit v1.2.3