diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-02-17 23:45:14 +0100 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-02-22 21:42:09 +0100 |
commit | 8ebd339031cf9826629ad780dd35fee130e95985 (patch) | |
tree | 6a8a1b59040f55404e3cb3e3cf2860bd4879bd40 /src/node_binding.h | |
parent | 455b927be0111a6aa8f1e30ae5b21659afeba40d (diff) | |
download | android-node-v8-8ebd339031cf9826629ad780dd35fee130e95985.tar.gz android-node-v8-8ebd339031cf9826629ad780dd35fee130e95985.tar.bz2 android-node-v8-8ebd339031cf9826629ad780dd35fee130e95985.zip |
worker: improve integration with native addons
Allow loading add-ons from multiple Node.js instances if they are
declared context-aware; in particular, this applies to N-API addons.
Also, plug a memory leak that occurred when registering N-API addons.
Refs: https://github.com/nodejs/node/pull/23319
PR-URL: https://github.com/nodejs/node/pull/26175
Fixes: https://github.com/nodejs/node/issues/21481
Fixes: https://github.com/nodejs/node/issues/21783
Fixes: https://github.com/nodejs/node/issues/25662
Fixes: https://github.com/nodejs/node/issues/20239
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Diffstat (limited to 'src/node_binding.h')
-rw-r--r-- | src/node_binding.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/node_binding.h b/src/node_binding.h index d73e18548f..fcd7f34ac6 100644 --- a/src/node_binding.h +++ b/src/node_binding.h @@ -18,6 +18,7 @@ enum { NM_F_BUILTIN = 1 << 0, // Unused. NM_F_LINKED = 1 << 1, NM_F_INTERNAL = 1 << 2, + NM_F_DELETEME = 1 << 3, }; #define NODE_MODULE_CONTEXT_AWARE_CPP(modname, regfunc, priv, flags) \ @@ -62,6 +63,8 @@ class DLib { bool Open(); void Close(); void* GetSymbolAddress(const char* name); + void SaveInGlobalHandleMap(node_module* mp); + node_module* GetSavedModuleFromGlobalHandleMap(); const std::string filename_; const int flags_; @@ -70,6 +73,7 @@ class DLib { #ifndef __POSIX__ uv_lib_t lib_; #endif + bool has_entry_in_global_handle_map_ = false; private: DISALLOW_COPY_AND_ASSIGN(DLib); |