|
31 | 31 | #include "node_errors.h" |
32 | 32 | #include "node_internals.h" |
33 | 33 | #include "node_metadata.h" |
34 | | -#include "node_native_module.h" |
| 34 | +#include "node_native_module_env.h" |
35 | 35 | #include "node_options-inl.h" |
36 | 36 | #include "node_perf.h" |
37 | 37 | #include "node_platform.h" |
|
118 | 118 |
|
119 | 119 | namespace node { |
120 | 120 |
|
| 121 | +using native_module::NativeModuleEnv; |
121 | 122 | using options_parser::kAllowedInEnvironment; |
122 | 123 | using options_parser::kDisallowedInEnvironment; |
| 124 | + |
123 | 125 | using v8::Array; |
124 | 126 | using v8::Boolean; |
125 | 127 | using v8::Context; |
@@ -207,8 +209,7 @@ MaybeLocal<Value> ExecuteBootstrapper(Environment* env, |
207 | 209 | std::vector<Local<Value>>* arguments) { |
208 | 210 | EscapableHandleScope scope(env->isolate()); |
209 | 211 | MaybeLocal<Function> maybe_fn = |
210 | | - per_process::native_module_loader.LookupAndCompile( |
211 | | - env->context(), id, parameters, env); |
| 212 | + NativeModuleEnv::LookupAndCompile(env->context(), id, parameters, env); |
212 | 213 |
|
213 | 214 | if (maybe_fn.IsEmpty()) { |
214 | 215 | return MaybeLocal<Value>(); |
@@ -401,7 +402,7 @@ MaybeLocal<Value> StartMainThreadExecution(Environment* env) { |
401 | 402 | // To allow people to extend Node in different ways, this hook allows |
402 | 403 | // one to drop a file lib/_third_party_main.js into the build |
403 | 404 | // directory which will be executed instead of Node's normal loading. |
404 | | - if (per_process::native_module_loader.Exists("_third_party_main")) { |
| 405 | + if (NativeModuleEnv::Exists("_third_party_main")) { |
405 | 406 | return StartExecution(env, "internal/main/run_third_party_main"); |
406 | 407 | } |
407 | 408 |
|
@@ -724,6 +725,8 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv, |
724 | 725 | per_process::metadata.versions.InitializeIntlVersions(); |
725 | 726 | #endif |
726 | 727 |
|
| 728 | + NativeModuleEnv::InitializeCodeCache(); |
| 729 | + |
727 | 730 | // We should set node_is_initialized here instead of in node::Start, |
728 | 731 | // otherwise embedders using node::Init to initialize everything will not be |
729 | 732 | // able to set it and native modules will not load for them. |
|
0 commit comments