Skip to content

Commit

Permalink
src: support fs_event_wrap binding in the snapshot
Browse files Browse the repository at this point in the history
PR-URL: #38737
Refs: #35711
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
joyeecheung authored and danielleadams committed May 31, 2021
1 parent 21ce3af commit a1b0e64
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/fs_event_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -52,6 +52,7 @@ class FSEventWrap: public HandleWrap {
Local<Value> unused,
Local<Context> context,
void* priv);
static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
static void New(const FunctionCallbackInfo<Value>& args);
static void Start(const FunctionCallbackInfo<Value>& args);
static void GetInitialized(const FunctionCallbackInfo<Value>& args);
Expand Down Expand Up @@ -117,6 +118,12 @@ void FSEventWrap::Initialize(Local<Object> 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<Value>& args) {
CHECK(args.IsConstructCall());
Expand Down Expand Up @@ -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)
1 change: 1 addition & 0 deletions src/node_external_reference.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down

0 comments on commit a1b0e64

Please sign in to comment.