Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
src: register external references of TTYWrap for snapshot
  • Loading branch information
joyeecheung committed Sep 1, 2021
commit 713139c6e875173433eff031a83de36f2f9d5207
1 change: 1 addition & 0 deletions src/node_external_reference.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,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 @@ -146,3 +154,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