mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
src: register zlib external references for snapshot
PR-URL: https://github.com/nodejs/node/pull/40050 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Khaidi Chu <i@2333.moe>
This commit is contained in:
committed by
Michael Dawson
parent
f182b9b29f
commit
58b7d47ad2
@@ -81,6 +81,7 @@ class ExternalReferenceRegistry {
|
||||
V(types) \
|
||||
V(uv) \
|
||||
V(v8) \
|
||||
V(zlib) \
|
||||
V(worker)
|
||||
|
||||
#if NODE_HAVE_I18N_SUPPORT
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "async_wrap-inl.h"
|
||||
#include "env-inl.h"
|
||||
#include "node_external_reference.h"
|
||||
#include "threadpoolwork-inl.h"
|
||||
#include "util-inl.h"
|
||||
|
||||
@@ -1266,6 +1267,16 @@ struct MakeClass {
|
||||
|
||||
env->SetConstructorFunction(target, name, z);
|
||||
}
|
||||
|
||||
static void Make(ExternalReferenceRegistry* registry) {
|
||||
registry->Register(Stream::New);
|
||||
registry->Register(Stream::template Write<true>);
|
||||
registry->Register(Stream::template Write<false>);
|
||||
registry->Register(Stream::Close);
|
||||
registry->Register(Stream::Init);
|
||||
registry->Register(Stream::Params);
|
||||
registry->Register(Stream::Reset);
|
||||
}
|
||||
};
|
||||
|
||||
void Initialize(Local<Object> target,
|
||||
@@ -1283,6 +1294,12 @@ void Initialize(Local<Object> target,
|
||||
FIXED_ONE_BYTE_STRING(env->isolate(), ZLIB_VERSION)).Check();
|
||||
}
|
||||
|
||||
void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
|
||||
MakeClass<ZlibStream>::Make(registry);
|
||||
MakeClass<BrotliEncoderStream>::Make(registry);
|
||||
MakeClass<BrotliDecoderStream>::Make(registry);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
void DefineZlibConstants(Local<Object> target) {
|
||||
@@ -1408,3 +1425,4 @@ void DefineZlibConstants(Local<Object> target) {
|
||||
} // namespace node
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_INTERNAL(zlib, node::Initialize)
|
||||
NODE_MODULE_EXTERNAL_REFERENCE(zlib, node::RegisterExternalReferences)
|
||||
|
||||
Reference in New Issue
Block a user