Skip to content

Commit

Permalink
src: register external references of TTYWrap for snapshot
Browse files Browse the repository at this point in the history
PR-URL: #39961
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
  • Loading branch information
joyeecheung authored and BethGriggs committed Sep 21, 2021
1 parent 00cca48 commit 7a17cbf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/node_external_reference.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class ExternalReferenceRegistry {
V(report) \
V(task_queue) \
V(tcp_wrap) \
V(tty_wrap) \
V(url) \
V(util) \
V(serdes) \
Expand Down
10 changes: 10 additions & 0 deletions src/tty_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "env-inl.h"
#include "handle_wrap.h"
#include "node_buffer.h"
#include "node_external_reference.h"
#include "stream_base-inl.h"
#include "stream_wrap.h"
#include "util-inl.h"
Expand All @@ -40,6 +41,13 @@ using v8::Object;
using v8::String;
using v8::Value;

void TTYWrap::RegisterExternalReferences(ExternalReferenceRegistry* registry) {
registry->Register(New);
registry->Register(GetWindowSize);
registry->Register(SetRawMode);
registry->Register(IsTTY);
}

void TTYWrap::Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context,
Expand Down Expand Up @@ -147,3 +155,5 @@ TTYWrap::TTYWrap(Environment* env,
} // namespace node

NODE_MODULE_CONTEXT_AWARE_INTERNAL(tty_wrap, node::TTYWrap::Initialize)
NODE_MODULE_EXTERNAL_REFERENCE(tty_wrap,
node::TTYWrap::RegisterExternalReferences)
2 changes: 2 additions & 0 deletions src/tty_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@
namespace node {

class Environment;
class ExternalReferenceRegistry;

class TTYWrap : public LibuvStreamWrap {
public:
static void Initialize(v8::Local<v8::Object> target,
v8::Local<v8::Value> unused,
v8::Local<v8::Context> context,
void* priv);
static void RegisterExternalReferences(ExternalReferenceRegistry* registry);

SET_NO_MEMORY_INFO()
SET_MEMORY_INFO_NAME(TTYWrap)
Expand Down

0 comments on commit 7a17cbf

Please sign in to comment.