diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/node_binding.cc | 11 | ||||
-rw-r--r-- | src/node_external_reference.h | 5 | ||||
-rw-r--r-- | src/node_main_instance.cc | 9 | ||||
-rw-r--r-- | src/node_native_module_env.cc | 14 | ||||
-rw-r--r-- | src/node_native_module_env.h | 2 |
5 files changed, 38 insertions, 3 deletions
diff --git a/src/node_binding.cc b/src/node_binding.cc index 80ab4e69e11..4dbf56b99a3 100644 --- a/src/node_binding.cc +++ b/src/node_binding.cc @@ -1,7 +1,8 @@ #include "node_binding.h" -#include "node_errors.h" #include <atomic> #include "env-inl.h" +#include "node_errors.h" +#include "node_external_reference.h" #include "node_native_module_env.h" #include "util.h" @@ -676,5 +677,13 @@ void RegisterBuiltinModules() { #undef V } +void RegisterExternalReferences(ExternalReferenceRegistry* registry) { + registry->Register(GetLinkedBinding); + registry->Register(GetInternalBinding); +} + } // namespace binding } // namespace node + +NODE_MODULE_EXTERNAL_REFERENCE(binding, + node::binding::RegisterExternalReferences) diff --git a/src/node_external_reference.h b/src/node_external_reference.h index 29dd4cb91ed..8c97eca2264 100644 --- a/src/node_external_reference.h +++ b/src/node_external_reference.h @@ -46,7 +46,10 @@ class ExternalReferenceRegistry { std::vector<intptr_t> external_references_; }; -#define EXTERNAL_REFERENCE_BINDING_LIST_BASE(V) V(process_object) +#define EXTERNAL_REFERENCE_BINDING_LIST_BASE(V) \ + V(binding) \ + V(native_module) \ + V(process_object) #define EXTERNAL_REFERENCE_BINDING_LIST(V) \ EXTERNAL_REFERENCE_BINDING_LIST_BASE(V) diff --git a/src/node_main_instance.cc b/src/node_main_instance.cc index 9fefc371d66..617a71e7cac 100644 --- a/src/node_main_instance.cc +++ b/src/node_main_instance.cc @@ -259,10 +259,17 @@ NodeMainInstance::CreateMainEnvironment(int* exit_code, env->InitializeInspector({}); #endif - if (env->RunBootstrapping().IsEmpty()) { + if (!deserialize_mode_ && env->RunBootstrapping().IsEmpty()) { return nullptr; } + if (deserialize_mode_ && env->BootstrapNode().IsEmpty()) { + return nullptr; + } + + CHECK(env->req_wrap_queue()->IsEmpty()); + CHECK(env->handle_wrap_queue()->IsEmpty()); + env->set_has_run_bootstrapping_code(true); return env; } diff --git a/src/node_native_module_env.cc b/src/node_native_module_env.cc index e38529eefae..b59ed7cb75c 100644 --- a/src/node_native_module_env.cc +++ b/src/node_native_module_env.cc @@ -1,5 +1,6 @@ #include "node_native_module_env.h" #include "env-inl.h" +#include "node_external_reference.h" namespace node { namespace native_module { @@ -216,8 +217,21 @@ void NativeModuleEnv::Initialize(Local<Object> target, target->SetIntegrityLevel(context, IntegrityLevel::kFrozen).FromJust(); } +void NativeModuleEnv::RegisterExternalReferences( + ExternalReferenceRegistry* registry) { + registry->Register(ConfigStringGetter); + registry->Register(ModuleIdsGetter); + registry->Register(GetModuleCategories); + registry->Register(GetCacheUsage); + registry->Register(CompileFunction); + registry->Register(HasCachedBuiltins); +} + } // namespace native_module } // namespace node NODE_MODULE_CONTEXT_AWARE_INTERNAL( native_module, node::native_module::NativeModuleEnv::Initialize) +NODE_MODULE_EXTERNAL_REFERENCE( + native_module, + node::native_module::NativeModuleEnv::RegisterExternalReferences) diff --git a/src/node_native_module_env.h b/src/node_native_module_env.h index bc36be75109..0a53771ff5d 100644 --- a/src/node_native_module_env.h +++ b/src/node_native_module_env.h @@ -7,6 +7,7 @@ namespace node { class Environment; +class ExternalReferenceRegistry; namespace native_module { @@ -14,6 +15,7 @@ extern const bool has_code_cache; class NativeModuleEnv { public: + static void RegisterExternalReferences(ExternalReferenceRegistry* registry); static void Initialize(v8::Local<v8::Object> target, v8::Local<v8::Value> unused, v8::Local<v8::Context> context, |