Skip to content

Commit

Permalink
src: register external references of PipeWrap for snapshot
Browse files Browse the repository at this point in the history
PR-URL: #39961
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <midawson@redhat.com>
  • Loading branch information
joyeecheung authored and BethGriggs committed Sep 21, 2021
1 parent 7a17cbf commit 826eee3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/node_external_reference.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class ExternalReferenceRegistry {
V(tty_wrap) \
V(url) \
V(util) \
V(pipe_wrap) \
V(serdes) \
V(string_decoder) \
V(stream_wrap) \
Expand Down
16 changes: 15 additions & 1 deletion src/pipe_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@
#include "pipe_wrap.h"

#include "async_wrap.h"
#include "connect_wrap.h"
#include "connection_wrap.h"
#include "env-inl.h"
#include "handle_wrap.h"
#include "node.h"
#include "node_buffer.h"
#include "connect_wrap.h"
#include "node_external_reference.h"
#include "stream_base-inl.h"
#include "stream_wrap.h"
#include "util-inl.h"
Expand Down Expand Up @@ -104,6 +105,17 @@ void PipeWrap::Initialize(Local<Object> target,
constants).Check();
}

void PipeWrap::RegisterExternalReferences(ExternalReferenceRegistry* registry) {
registry->Register(New);
registry->Register(Bind);
registry->Register(Listen);
registry->Register(Connect);
registry->Register(Open);
#ifdef _WIN32
registry->Register(SetPendingInstances);
#endif
registry->Register(Fchmod);
}

void PipeWrap::New(const FunctionCallbackInfo<Value>& args) {
// This constructor should not be exposed to public javascript.
Expand Down Expand Up @@ -236,3 +248,5 @@ void PipeWrap::Connect(const FunctionCallbackInfo<Value>& args) {
} // namespace node

NODE_MODULE_CONTEXT_AWARE_INTERNAL(pipe_wrap, node::PipeWrap::Initialize)
NODE_MODULE_EXTERNAL_REFERENCE(pipe_wrap,
node::PipeWrap::RegisterExternalReferences)
2 changes: 2 additions & 0 deletions src/pipe_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

namespace node {

class ExternalReferenceRegistry;
class Environment;

class PipeWrap : public ConnectionWrap<PipeWrap, uv_pipe_t> {
Expand All @@ -47,6 +48,7 @@ class PipeWrap : public ConnectionWrap<PipeWrap, uv_pipe_t> {
v8::Local<v8::Context> context,
void* priv);

static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
SET_NO_MEMORY_INFO()
SET_MEMORY_INFO_NAME(PipeWrap)
SET_SELF_SIZE(PipeWrap)
Expand Down

0 comments on commit 826eee3

Please sign in to comment.