From 39b0f4fe4c4e663be5529228dcd41d5133468eed Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Thu, 20 May 2021 01:49:32 +0800 Subject: [PATCH] src: support fs_event_wrap binding in the snapshot PR-URL: https://github.com/nodejs/node/pull/38737 Refs: https://github.com/nodejs/node/issues/35711 Reviewed-By: Anna Henningsen --- src/fs_event_wrap.cc | 13 +++++++++++-- src/node_external_reference.h | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/fs_event_wrap.cc b/src/fs_event_wrap.cc index b79da7e83622c9..f13d22535c1015 100644 --- a/src/fs_event_wrap.cc +++ b/src/fs_event_wrap.cc @@ -21,11 +21,11 @@ #include "async_wrap-inl.h" #include "env-inl.h" -#include "node.h" #include "handle_wrap.h" +#include "node.h" +#include "node_external_reference.h" #include "string_bytes.h" - namespace node { using v8::Context; @@ -52,6 +52,7 @@ class FSEventWrap: public HandleWrap { Local unused, Local context, void* priv); + static void RegisterExternalReferences(ExternalReferenceRegistry* registry); static void New(const FunctionCallbackInfo& args); static void Start(const FunctionCallbackInfo& args); static void GetInitialized(const FunctionCallbackInfo& args); @@ -117,6 +118,12 @@ void FSEventWrap::Initialize(Local target, env->SetConstructorFunction(target, "FSEvent", t); } +void FSEventWrap::RegisterExternalReferences( + ExternalReferenceRegistry* registry) { + registry->Register(New); + registry->Register(Start); + registry->Register(GetInitialized); +} void FSEventWrap::New(const FunctionCallbackInfo& args) { CHECK(args.IsConstructCall()); @@ -229,3 +236,5 @@ void FSEventWrap::OnEvent(uv_fs_event_t* handle, const char* filename, } // namespace node NODE_MODULE_CONTEXT_AWARE_INTERNAL(fs_event_wrap, node::FSEventWrap::Initialize) +NODE_MODULE_EXTERNAL_REFERENCE(fs_event_wrap, + node::FSEventWrap::RegisterExternalReferences) diff --git a/src/node_external_reference.h b/src/node_external_reference.h index 5f64870178fe6d..2d6bc34322fd61 100644 --- a/src/node_external_reference.h +++ b/src/node_external_reference.h @@ -56,6 +56,7 @@ class ExternalReferenceRegistry { V(errors) \ V(fs) \ V(fs_dir) \ + V(fs_event_wrap) \ V(handle_wrap) \ V(heap_utils) \ V(messaging) \