src: make a Environment-independent proxy class for NativeModuleLoader

This patch splits `NativeModuleLoader` into two parts - a singleton
that only relies on v8 and `node::Mutex` and a proxy class for
the singleton (`NativeModuleEnv`) that provides limited access to
the singleton as well as C++ bindings for the Node.js binary.
`NativeModuleLoader` is then no longer aware of `Environment`.

PR-URL: https://github.com/nodejs/node/pull/27160
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
This commit is contained in:
Joyee Cheung committed 2019-04-13 17:24:51 +08:00
1 parent 9b6b567bc4
commit dfd7e99425
12 files changed
+433 -331

No files matched your search

+3 -3
View File
@@ -30,9 +30,9 @@ if (child.status !== 0) {
}
// Verifies that:
// - node::LoadCodeCache()
// - NativeModuleEnv::InitializeCodeCache()
// are defined in the generated code.
// See src/node_native_module.h for explanations.
// See src/node_native_module_env.h for explanations.
const rl = readline.createInterface({
input: fs.createReadStream(dest),
@@ -42,7 +42,7 @@ const rl = readline.createInterface({
let hasCacheDef = false;
rl.on('line', common.mustCallAtLeast((line) => {
if (line.includes('LoadCodeCache(')) {
if (line.includes('InitializeCodeCache(')) {
hasCacheDef = true;
}
}, 2));