GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: node_serdes.cc Lines: 203 251 80.9 %
Date: 2022-09-11 04:22:34 Branches: 59 122 48.4 %

Line Branch Exec Source
1
#include "base_object-inl.h"
2
#include "node_buffer.h"
3
#include "node_errors.h"
4
#include "node_external_reference.h"
5
#include "node_internals.h"
6
#include "util-inl.h"
7
8
namespace node {
9
10
using v8::Array;
11
using v8::ArrayBuffer;
12
using v8::Context;
13
using v8::Function;
14
using v8::FunctionCallbackInfo;
15
using v8::FunctionTemplate;
16
using v8::Integer;
17
using v8::Isolate;
18
using v8::Just;
19
using v8::Local;
20
using v8::Maybe;
21
using v8::MaybeLocal;
22
using v8::Nothing;
23
using v8::Object;
24
using v8::SharedArrayBuffer;
25
using v8::String;
26
using v8::Value;
27
using v8::ValueDeserializer;
28
using v8::ValueSerializer;
29
30
namespace serdes {
31
32
class SerializerContext : public BaseObject,
33
                          public ValueSerializer::Delegate {
34
 public:
35
  SerializerContext(Environment* env,
36
                    Local<Object> wrap);
37
38
4005668
  ~SerializerContext() override = default;
39
40
  void ThrowDataCloneError(Local<String> message) override;
41
  Maybe<bool> WriteHostObject(Isolate* isolate, Local<Object> object) override;
42
  Maybe<uint32_t> GetSharedArrayBufferId(
43
      Isolate* isolate, Local<SharedArrayBuffer> shared_array_buffer) override;
44
45
  static void SetTreatArrayBufferViewsAsHostObjects(
46
      const FunctionCallbackInfo<Value>& args);
47
48
  static void New(const FunctionCallbackInfo<Value>& args);
49
  static void WriteHeader(const FunctionCallbackInfo<Value>& args);
50
  static void WriteValue(const FunctionCallbackInfo<Value>& args);
51
  static void ReleaseBuffer(const FunctionCallbackInfo<Value>& args);
52
  static void TransferArrayBuffer(const FunctionCallbackInfo<Value>& args);
53
  static void WriteUint32(const FunctionCallbackInfo<Value>& args);
54
  static void WriteUint64(const FunctionCallbackInfo<Value>& args);
55
  static void WriteDouble(const FunctionCallbackInfo<Value>& args);
56
  static void WriteRawBytes(const FunctionCallbackInfo<Value>& args);
57
58
  SET_NO_MEMORY_INFO()
59
  SET_MEMORY_INFO_NAME(SerializerContext)
60
  SET_SELF_SIZE(SerializerContext)
61
62
 private:
63
  ValueSerializer serializer_;
64
};
65
66
class DeserializerContext : public BaseObject,
67
                            public ValueDeserializer::Delegate {
68
 public:
69
  DeserializerContext(Environment* env,
70
                      Local<Object> wrap,
71
                      Local<Value> buffer);
72
73
5892
  ~DeserializerContext() override = default;
74
75
  MaybeLocal<Object> ReadHostObject(Isolate* isolate) override;
76
77
  static void New(const FunctionCallbackInfo<Value>& args);
78
  static void ReadHeader(const FunctionCallbackInfo<Value>& args);
79
  static void ReadValue(const FunctionCallbackInfo<Value>& args);
80
  static void TransferArrayBuffer(const FunctionCallbackInfo<Value>& args);
81
  static void GetWireFormatVersion(const FunctionCallbackInfo<Value>& args);
82
  static void ReadUint32(const FunctionCallbackInfo<Value>& args);
83
  static void ReadUint64(const FunctionCallbackInfo<Value>& args);
84
  static void ReadDouble(const FunctionCallbackInfo<Value>& args);
85
  static void ReadRawBytes(const FunctionCallbackInfo<Value>& args);
86
87
  SET_NO_MEMORY_INFO()
88
  SET_MEMORY_INFO_NAME(DeserializerContext)
89
  SET_SELF_SIZE(DeserializerContext)
90
91
 private:
92
  const uint8_t* data_;
93
  const size_t length_;
94
95
  ValueDeserializer deserializer_;
96
};
97
98
1001417
SerializerContext::SerializerContext(Environment* env, Local<Object> wrap)
99
  : BaseObject(env, wrap),
100
1001417
    serializer_(env->isolate(), this) {
101
1001417
  MakeWeak();
102
1001417
}
103
104
2
void SerializerContext::ThrowDataCloneError(Local<String> message) {
105
2
  Local<Value> args[1] = { message };
106
  Local<Value> get_data_clone_error =
107
2
      object()->Get(env()->context(),
108
4
                    env()->get_data_clone_error_string())
109
2
                      .ToLocalChecked();
110
111
2
  CHECK(get_data_clone_error->IsFunction());
112
  MaybeLocal<Value> error =
113
2
      get_data_clone_error.As<Function>()->Call(env()->context(),
114
                                                object(),
115
2
                                                arraysize(args),
116
4
                                                args);
117
118
2
  if (error.IsEmpty()) return;
119
120
4
  env()->isolate()->ThrowException(error.ToLocalChecked());
121
}
122
123
Maybe<uint32_t> SerializerContext::GetSharedArrayBufferId(
124
    Isolate* isolate, Local<SharedArrayBuffer> shared_array_buffer) {
125
  Local<Value> args[1] = { shared_array_buffer };
126
  Local<Value> get_shared_array_buffer_id =
127
      object()->Get(env()->context(),
128
                    env()->get_shared_array_buffer_id_string())
129
                      .ToLocalChecked();
130
131
  if (!get_shared_array_buffer_id->IsFunction()) {
132
    return ValueSerializer::Delegate::GetSharedArrayBufferId(
133
        isolate, shared_array_buffer);
134
  }
135
136
  MaybeLocal<Value> id =
137
      get_shared_array_buffer_id.As<Function>()->Call(env()->context(),
138
                                                      object(),
139
                                                      arraysize(args),
140
                                                      args);
141
142
  if (id.IsEmpty()) return Nothing<uint32_t>();
143
144
  return id.ToLocalChecked()->Uint32Value(env()->context());
145
}
146
147
102
Maybe<bool> SerializerContext::WriteHostObject(Isolate* isolate,
148
                                               Local<Object> input) {
149
  MaybeLocal<Value> ret;
150
102
  Local<Value> args[1] = { input };
151
152
  Local<Value> write_host_object =
153
102
      object()->Get(env()->context(),
154
306
                    env()->write_host_object_string()).ToLocalChecked();
155
156
102
  if (!write_host_object->IsFunction()) {
157
    return ValueSerializer::Delegate::WriteHostObject(isolate, input);
158
  }
159
160
102
  ret = write_host_object.As<Function>()->Call(env()->context(),
161
                                               object(),
162
102
                                               arraysize(args),
163
204
                                               args);
164
165
102
  if (ret.IsEmpty())
166
2
    return Nothing<bool>();
167
168
100
  return Just(true);
169
}
170
171
1001418
void SerializerContext::New(const FunctionCallbackInfo<Value>& args) {
172
1001418
  Environment* env = Environment::GetCurrent(args);
173
1001418
  if (!args.IsConstructCall()) {
174
1
    return THROW_ERR_CONSTRUCT_CALL_REQUIRED(
175
1
        env, "Class constructor Serializer cannot be invoked without 'new'");
176
  }
177
178
1001417
  new SerializerContext(env, args.This());
179
}
180
181
1001416
void SerializerContext::WriteHeader(const FunctionCallbackInfo<Value>& args) {
182
  SerializerContext* ctx;
183
1001416
  ASSIGN_OR_RETURN_UNWRAP(&ctx, args.Holder());
184
1001416
  ctx->serializer_.WriteHeader();
185
}
186
187
1001432
void SerializerContext::WriteValue(const FunctionCallbackInfo<Value>& args) {
188
  SerializerContext* ctx;
189
1001432
  ASSIGN_OR_RETURN_UNWRAP(&ctx, args.Holder());
190
  Maybe<bool> ret =
191
2002864
      ctx->serializer_.WriteValue(ctx->env()->context(), args[0]);
192
193

4005716
  if (ret.IsJust()) args.GetReturnValue().Set(ret.FromJust());
194
}
195
196
1001415
void SerializerContext::SetTreatArrayBufferViewsAsHostObjects(
197
    const FunctionCallbackInfo<Value>& args) {
198
  SerializerContext* ctx;
199
1001415
  ASSIGN_OR_RETURN_UNWRAP(&ctx, args.Holder());
200
201
1001415
  bool value = args[0]->BooleanValue(ctx->env()->isolate());
202
1001415
  ctx->serializer_.SetTreatArrayBufferViewsAsHostObjects(value);
203
}
204
205
1001412
void SerializerContext::ReleaseBuffer(const FunctionCallbackInfo<Value>& args) {
206
  SerializerContext* ctx;
207
1001412
  ASSIGN_OR_RETURN_UNWRAP(&ctx, args.Holder());
208
209
  // Note: Both ValueSerializer and this Buffer::New() variant use malloc()
210
  // as the underlying allocator.
211
1001412
  std::pair<uint8_t*, size_t> ret = ctx->serializer_.Release();
212
  auto buf = Buffer::New(ctx->env(),
213
1001412
                         reinterpret_cast<char*>(ret.first),
214
1001412
                         ret.second);
215
216
1001412
  if (!buf.IsEmpty()) {
217
2002824
    args.GetReturnValue().Set(buf.ToLocalChecked());
218
  }
219
}
220
221
void SerializerContext::TransferArrayBuffer(
222
    const FunctionCallbackInfo<Value>& args) {
223
  SerializerContext* ctx;
224
  ASSIGN_OR_RETURN_UNWRAP(&ctx, args.Holder());
225
226
  Maybe<uint32_t> id = args[0]->Uint32Value(ctx->env()->context());
227
  if (id.IsNothing()) return;
228
229
  if (!args[1]->IsArrayBuffer())
230
    return node::THROW_ERR_INVALID_ARG_TYPE(
231
        ctx->env(), "arrayBuffer must be an ArrayBuffer");
232
233
  Local<ArrayBuffer> ab = args[1].As<ArrayBuffer>();
234
  ctx->serializer_.TransferArrayBuffer(id.FromJust(), ab);
235
  return;
236
}
237
238
205
void SerializerContext::WriteUint32(const FunctionCallbackInfo<Value>& args) {
239
  SerializerContext* ctx;
240
205
  ASSIGN_OR_RETURN_UNWRAP(&ctx, args.Holder());
241
242
205
  Maybe<uint32_t> value = args[0]->Uint32Value(ctx->env()->context());
243
205
  if (value.IsNothing()) return;
244
245
410
  ctx->serializer_.WriteUint32(value.FromJust());
246
}
247
248
1
void SerializerContext::WriteUint64(const FunctionCallbackInfo<Value>& args) {
249
  SerializerContext* ctx;
250
1
  ASSIGN_OR_RETURN_UNWRAP(&ctx, args.Holder());
251
252
1
  Maybe<uint32_t> arg0 = args[0]->Uint32Value(ctx->env()->context());
253
1
  Maybe<uint32_t> arg1 = args[1]->Uint32Value(ctx->env()->context());
254

2
  if (arg0.IsNothing() || arg1.IsNothing())
255
    return;
256
257
1
  uint64_t hi = arg0.FromJust();
258
1
  uint64_t lo = arg1.FromJust();
259
1
  ctx->serializer_.WriteUint64((hi << 32) | lo);
260
}
261
262
1
void SerializerContext::WriteDouble(const FunctionCallbackInfo<Value>& args) {
263
  SerializerContext* ctx;
264
1
  ASSIGN_OR_RETURN_UNWRAP(&ctx, args.Holder());
265
266
1
  Maybe<double> value = args[0]->NumberValue(ctx->env()->context());
267
1
  if (value.IsNothing()) return;
268
269
2
  ctx->serializer_.WriteDouble(value.FromJust());
270
}
271
272
122
void SerializerContext::WriteRawBytes(const FunctionCallbackInfo<Value>& args) {
273
  SerializerContext* ctx;
274
123
  ASSIGN_OR_RETURN_UNWRAP(&ctx, args.Holder());
275
276
122
  if (!args[0]->IsArrayBufferView()) {
277
1
    return node::THROW_ERR_INVALID_ARG_TYPE(
278
1
        ctx->env(), "source must be a TypedArray or a DataView");
279
  }
280
281
121
  ArrayBufferViewContents<char> bytes(args[0]);
282
121
  ctx->serializer_.WriteRawBytes(bytes.data(), bytes.length());
283
}
284
285
1473
DeserializerContext::DeserializerContext(Environment* env,
286
                                         Local<Object> wrap,
287
1473
                                         Local<Value> buffer)
288
  : BaseObject(env, wrap),
289
1473
    data_(reinterpret_cast<const uint8_t*>(Buffer::Data(buffer))),
290
1473
    length_(Buffer::Length(buffer)),
291
1473
    deserializer_(env->isolate(), data_, length_, this) {
292
4419
  object()->Set(env->context(), env->buffer_string(), buffer).Check();
293
294
1473
  MakeWeak();
295
1473
}
296
297
137
MaybeLocal<Object> DeserializerContext::ReadHostObject(Isolate* isolate) {
298
  Local<Value> read_host_object =
299
137
      object()->Get(env()->context(),
300
411
                    env()->read_host_object_string()).ToLocalChecked();
301
302
137
  if (!read_host_object->IsFunction()) {
303
    return ValueDeserializer::Delegate::ReadHostObject(isolate);
304
  }
305
306
274
  Isolate::AllowJavascriptExecutionScope allow_js(isolate);
307
  MaybeLocal<Value> ret =
308
137
      read_host_object.As<Function>()->Call(env()->context(),
309
                                            object(),
310
                                            0,
311
274
                                            nullptr);
312
313
137
  if (ret.IsEmpty())
314
    return MaybeLocal<Object>();
315
316
137
  Local<Value> return_value = ret.ToLocalChecked();
317
137
  if (!return_value->IsObject()) {
318
    env()->ThrowTypeError("readHostObject must return an object");
319
    return MaybeLocal<Object>();
320
  }
321
322
137
  return return_value.As<Object>();
323
}
324
325
1476
void DeserializerContext::New(const FunctionCallbackInfo<Value>& args) {
326
1476
  Environment* env = Environment::GetCurrent(args);
327
1476
  if (!args.IsConstructCall()) {
328
1
    return THROW_ERR_CONSTRUCT_CALL_REQUIRED(
329
1
        env, "Class constructor Deserializer cannot be invoked without 'new'");
330
  }
331
332
1475
  if (!args[0]->IsArrayBufferView()) {
333
2
    return node::THROW_ERR_INVALID_ARG_TYPE(
334
2
        env, "buffer must be a TypedArray or a DataView");
335
  }
336
337
2946
  new DeserializerContext(env, args.This(), args[0]);
338
}
339
340
1472
void DeserializerContext::ReadHeader(const FunctionCallbackInfo<Value>& args) {
341
  DeserializerContext* ctx;
342
1472
  ASSIGN_OR_RETURN_UNWRAP(&ctx, args.Holder());
343
344
1472
  Maybe<bool> ret = ctx->deserializer_.ReadHeader(ctx->env()->context());
345
346

5888
  if (ret.IsJust()) args.GetReturnValue().Set(ret.FromJust());
347
}
348
349
1489
void DeserializerContext::ReadValue(const FunctionCallbackInfo<Value>& args) {
350
  DeserializerContext* ctx;
351
1489
  ASSIGN_OR_RETURN_UNWRAP(&ctx, args.Holder());
352
353
1489
  MaybeLocal<Value> ret = ctx->deserializer_.ReadValue(ctx->env()->context());
354
355

4467
  if (!ret.IsEmpty()) args.GetReturnValue().Set(ret.ToLocalChecked());
356
}
357
358
void DeserializerContext::TransferArrayBuffer(
359
    const FunctionCallbackInfo<Value>& args) {
360
  DeserializerContext* ctx;
361
  ASSIGN_OR_RETURN_UNWRAP(&ctx, args.Holder());
362
363
  Maybe<uint32_t> id = args[0]->Uint32Value(ctx->env()->context());
364
  if (id.IsNothing()) return;
365
366
  if (args[1]->IsArrayBuffer()) {
367
    Local<ArrayBuffer> ab = args[1].As<ArrayBuffer>();
368
    ctx->deserializer_.TransferArrayBuffer(id.FromJust(), ab);
369
    return;
370
  }
371
372
  if (args[1]->IsSharedArrayBuffer()) {
373
    Local<SharedArrayBuffer> sab = args[1].As<SharedArrayBuffer>();
374
    ctx->deserializer_.TransferSharedArrayBuffer(id.FromJust(), sab);
375
    return;
376
  }
377
378
  return node::THROW_ERR_INVALID_ARG_TYPE(
379
      ctx->env(), "arrayBuffer must be an ArrayBuffer or SharedArrayBuffer");
380
}
381
382
1
void DeserializerContext::GetWireFormatVersion(
383
    const FunctionCallbackInfo<Value>& args) {
384
  DeserializerContext* ctx;
385
1
  ASSIGN_OR_RETURN_UNWRAP(&ctx, args.Holder());
386
387
2
  args.GetReturnValue().Set(ctx->deserializer_.GetWireFormatVersion());
388
}
389
390
279
void DeserializerContext::ReadUint32(const FunctionCallbackInfo<Value>& args) {
391
  DeserializerContext* ctx;
392
279
  ASSIGN_OR_RETURN_UNWRAP(&ctx, args.Holder());
393
394
  uint32_t value;
395
279
  bool ok = ctx->deserializer_.ReadUint32(&value);
396
279
  if (!ok) return ctx->env()->ThrowError("ReadUint32() failed");
397
558
  return args.GetReturnValue().Set(value);
398
}
399
400
1
void DeserializerContext::ReadUint64(const FunctionCallbackInfo<Value>& args) {
401
  DeserializerContext* ctx;
402
1
  ASSIGN_OR_RETURN_UNWRAP(&ctx, args.Holder());
403
404
  uint64_t value;
405
1
  bool ok = ctx->deserializer_.ReadUint64(&value);
406
1
  if (!ok) return ctx->env()->ThrowError("ReadUint64() failed");
407
408
1
  uint32_t hi = static_cast<uint32_t>(value >> 32);
409
1
  uint32_t lo = static_cast<uint32_t>(value);
410
411
1
  Isolate* isolate = ctx->env()->isolate();
412
413
  Local<Value> ret[] = {
414
    Integer::NewFromUnsigned(isolate, hi),
415
    Integer::NewFromUnsigned(isolate, lo)
416
3
  };
417
2
  return args.GetReturnValue().Set(Array::New(isolate, ret, arraysize(ret)));
418
}
419
420
2
void DeserializerContext::ReadDouble(const FunctionCallbackInfo<Value>& args) {
421
  DeserializerContext* ctx;
422
2
  ASSIGN_OR_RETURN_UNWRAP(&ctx, args.Holder());
423
424
  double value;
425
2
  bool ok = ctx->deserializer_.ReadDouble(&value);
426
2
  if (!ok) return ctx->env()->ThrowError("ReadDouble() failed");
427
2
  return args.GetReturnValue().Set(value);
428
}
429
430
137
void DeserializerContext::ReadRawBytes(
431
    const FunctionCallbackInfo<Value>& args) {
432
  DeserializerContext* ctx;
433
137
  ASSIGN_OR_RETURN_UNWRAP(&ctx, args.Holder());
434
435
137
  Maybe<int64_t> length_arg = args[0]->IntegerValue(ctx->env()->context());
436
137
  if (length_arg.IsNothing()) return;
437
137
  size_t length = length_arg.FromJust();
438
439
  const void* data;
440
137
  bool ok = ctx->deserializer_.ReadRawBytes(length, &data);
441
137
  if (!ok) return ctx->env()->ThrowError("ReadRawBytes() failed");
442
443
137
  const uint8_t* position = reinterpret_cast<const uint8_t*>(data);
444
137
  CHECK_GE(position, ctx->data_);
445
137
  CHECK_LE(position + length, ctx->data_ + ctx->length_);
446
447
137
  const uint32_t offset = static_cast<uint32_t>(position - ctx->data_);
448
137
  CHECK_EQ(ctx->data_ + offset, position);
449
450
274
  args.GetReturnValue().Set(offset);
451
}
452
453
785
void Initialize(Local<Object> target,
454
                Local<Value> unused,
455
                Local<Context> context,
456
                void* priv) {
457
785
  Environment* env = Environment::GetCurrent(context);
458
785
  Isolate* isolate = env->isolate();
459
460
  Local<FunctionTemplate> ser =
461
785
      NewFunctionTemplate(isolate, SerializerContext::New);
462
463
1570
  ser->InstanceTemplate()->SetInternalFieldCount(
464
      SerializerContext::kInternalFieldCount);
465
785
  ser->Inherit(BaseObject::GetConstructorTemplate(env));
466
467
785
  SetProtoMethod(isolate, ser, "writeHeader", SerializerContext::WriteHeader);
468
785
  SetProtoMethod(isolate, ser, "writeValue", SerializerContext::WriteValue);
469
785
  SetProtoMethod(
470
      isolate, ser, "releaseBuffer", SerializerContext::ReleaseBuffer);
471
785
  SetProtoMethod(isolate,
472
                 ser,
473
                 "transferArrayBuffer",
474
                 SerializerContext::TransferArrayBuffer);
475
785
  SetProtoMethod(isolate, ser, "writeUint32", SerializerContext::WriteUint32);
476
785
  SetProtoMethod(isolate, ser, "writeUint64", SerializerContext::WriteUint64);
477
785
  SetProtoMethod(isolate, ser, "writeDouble", SerializerContext::WriteDouble);
478
785
  SetProtoMethod(
479
      isolate, ser, "writeRawBytes", SerializerContext::WriteRawBytes);
480
785
  SetProtoMethod(isolate,
481
                 ser,
482
                 "_setTreatArrayBufferViewsAsHostObjects",
483
                 SerializerContext::SetTreatArrayBufferViewsAsHostObjects);
484
485
785
  ser->ReadOnlyPrototype();
486
785
  SetConstructorFunction(context, target, "Serializer", ser);
487
488
  Local<FunctionTemplate> des =
489
785
      NewFunctionTemplate(isolate, DeserializerContext::New);
490
491
1570
  des->InstanceTemplate()->SetInternalFieldCount(
492
      DeserializerContext::kInternalFieldCount);
493
785
  des->Inherit(BaseObject::GetConstructorTemplate(env));
494
495
785
  SetProtoMethod(isolate, des, "readHeader", DeserializerContext::ReadHeader);
496
785
  SetProtoMethod(isolate, des, "readValue", DeserializerContext::ReadValue);
497
785
  SetProtoMethod(isolate,
498
                 des,
499
                 "getWireFormatVersion",
500
                 DeserializerContext::GetWireFormatVersion);
501
785
  SetProtoMethod(isolate,
502
                 des,
503
                 "transferArrayBuffer",
504
                 DeserializerContext::TransferArrayBuffer);
505
785
  SetProtoMethod(isolate, des, "readUint32", DeserializerContext::ReadUint32);
506
785
  SetProtoMethod(isolate, des, "readUint64", DeserializerContext::ReadUint64);
507
785
  SetProtoMethod(isolate, des, "readDouble", DeserializerContext::ReadDouble);
508
785
  SetProtoMethod(
509
      isolate, des, "_readRawBytes", DeserializerContext::ReadRawBytes);
510
511
785
  des->SetLength(1);
512
785
  des->ReadOnlyPrototype();
513
785
  SetConstructorFunction(context, target, "Deserializer", des);
514
785
}
515
516
5514
void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
517
5514
  registry->Register(SerializerContext::New);
518
519
5514
  registry->Register(SerializerContext::WriteHeader);
520
5514
  registry->Register(SerializerContext::WriteValue);
521
5514
  registry->Register(SerializerContext::ReleaseBuffer);
522
5514
  registry->Register(SerializerContext::TransferArrayBuffer);
523
5514
  registry->Register(SerializerContext::WriteUint32);
524
5514
  registry->Register(SerializerContext::WriteUint64);
525
5514
  registry->Register(SerializerContext::WriteDouble);
526
5514
  registry->Register(SerializerContext::WriteRawBytes);
527
5514
  registry->Register(SerializerContext::SetTreatArrayBufferViewsAsHostObjects);
528
529
5514
  registry->Register(DeserializerContext::New);
530
5514
  registry->Register(DeserializerContext::ReadHeader);
531
5514
  registry->Register(DeserializerContext::ReadValue);
532
5514
  registry->Register(DeserializerContext::GetWireFormatVersion);
533
5514
  registry->Register(DeserializerContext::TransferArrayBuffer);
534
5514
  registry->Register(DeserializerContext::ReadUint32);
535
5514
  registry->Register(DeserializerContext::ReadUint64);
536
5514
  registry->Register(DeserializerContext::ReadDouble);
537
5514
  registry->Register(DeserializerContext::ReadRawBytes);
538
5514
}
539
540
}  // namespace serdes
541
}  // namespace node
542
543
5584
NODE_MODULE_CONTEXT_AWARE_INTERNAL(serdes, node::serdes::Initialize)
544
5514
NODE_MODULE_EXTERNAL_REFERENCE(serdes, node::serdes::RegisterExternalReferences)