summaryrefslogtreecommitdiff
path: root/node.gyp
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2019-04-20 21:35:27 +0800
committerJoyee Cheung <joyeec9h3@gmail.com>2020-07-18 11:02:58 +0800
commitef9964f4c183f062ca25337984a542895590141d (patch)
tree35d1b1b8bc3e4b65aa6572b6e0ab4c0ec022e97d /node.gyp
parent404302fff5079b5d9faaecbb9a1b2de67f2d86cc (diff)
downloadios-node-v8-ef9964f4c183f062ca25337984a542895590141d.tar.gz
ios-node-v8-ef9964f4c183f062ca25337984a542895590141d.tar.bz2
ios-node-v8-ef9964f4c183f062ca25337984a542895590141d.zip
src: add an ExternalReferenceRegistry class
Add an ExternalReferenceRegistry class for registering static external references. To register the external JS to C++ references created in a binding (e.g. when a FunctionTemplate is created): - Add the binding name (same as the id used for `internalBinding()` and `NODE_MODULE_CONTEXT_AWARE_INTERNAL`) to `EXTERNAL_REFERENCE_BINDING_LIST` in `src/node_external_reference.h`. - In the file where the binding is implemented, create a registration function to register the static C++ references (e.g. the C++ functions in `v8::FunctionCallback` associated with the function templates), like this: ```c++ void RegisterExternalReferences( ExternalReferenceRegistry* registry) { registry->Register(cpp_func_1); } ``` - At the end of the file where `NODE_MODULE_CONTEXT_AWARE_INTERNAL` is also usually called, register the registration function with ``` NODE_MODULE_EXTERNAL_REFERENCE(binding_name, RegisterExternalReferences); ``` PR-URL: https://github.com/nodejs/node/pull/32984 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Diffstat (limited to 'node.gyp')
-rw-r--r--node.gyp2
1 files changed, 2 insertions, 0 deletions
diff --git a/node.gyp b/node.gyp
index 36cc88c629..acaf2cef8f 100644
--- a/node.gyp
+++ b/node.gyp
@@ -593,6 +593,7 @@
'src/node_dir.cc',
'src/node_env_var.cc',
'src/node_errors.cc',
+ 'src/node_external_reference.cc',
'src/node_file.cc',
'src/node_http_parser.cc',
'src/node_http2.cc',
@@ -687,6 +688,7 @@
'src/node_contextify.h',
'src/node_dir.h',
'src/node_errors.h',
+ 'src/node_external_reference.h',
'src/node_file.h',
'src/node_file-inl.h',
'src/node_http_common.h',