summaryrefslogtreecommitdiff
path: root/src/node_external_reference.h
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2021-07-10 01:54:09 +0800
committerMichaƫl Zasso <targos@protonmail.com>2021-11-21 16:07:37 +0100
commit3a4f3873be8b9a21d362dbc983c2efabcffe76e5 (patch)
treee8bfc425d56be6f6f04d4621480719032522407a /src/node_external_reference.h
parent88b57bc9d3bab7998c3de0aa787b88233cf46ed4 (diff)
downloadnode-new-3a4f3873be8b9a21d362dbc983c2efabcffe76e5.tar.gz
process: support hrtime in the snapshot
Put the hrtime backing store in the process methods binding data so that it can be integrated into the snapshot builder. For now we simply discard the contents of the hrtime buffer during serialization and create new buffers upon deserialization because the contents are only useful in a synchronous call. This also moves the helper function for creating V8 FastAPI methods into `Environment::SetFastMethod()` for code reuse. The v8::CFunction need to be created before the Environment is created so that we have the CTypeInfo address available for external reference registration. PR-URL: https://github.com/nodejs/node/pull/40649 Refs: https://github.com/nodejs/node/issues/35711 Refs: https://github.com/nodejs/node/issues/37476 Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_external_reference.h')
-rw-r--r--src/node_external_reference.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/node_external_reference.h b/src/node_external_reference.h
index 445ca19f3f..347945a749 100644
--- a/src/node_external_reference.h
+++ b/src/node_external_reference.h
@@ -5,10 +5,13 @@
#include <cinttypes>
#include <vector>
+#include "v8-fast-api-calls.h"
#include "v8.h"
namespace node {
+using CFunctionCallback = void (*)(v8::Local<v8::Value> receiver);
+
// This class manages the external references from the V8 heap
// to the C++ addresses in Node.js.
class ExternalReferenceRegistry {
@@ -16,6 +19,8 @@ class ExternalReferenceRegistry {
ExternalReferenceRegistry();
#define ALLOWED_EXTERNAL_REFERENCE_TYPES(V) \
+ V(CFunctionCallback) \
+ V(const v8::CFunctionInfo*) \
V(v8::FunctionCallback) \
V(v8::AccessorGetterCallback) \
V(v8::AccessorSetterCallback) \