From fa74cd352fa323a5301e68aa4c1b3bb5750c5280 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Wed, 19 Dec 2018 20:33:20 +0800 Subject: [PATCH] src: move symbols binding into node_symbols.cc PR-URL: https://github.com/nodejs/node/pull/25163 Refs: https://github.com/nodejs/node/issues/24961 Reviewed-By: Ruben Bridgewater Reviewed-By: Anatoli Papirovski --- node.gyp | 1 + src/bootstrapper.cc | 18 ------------------ src/node_symbols.cc | 29 +++++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 18 deletions(-) create mode 100644 src/node_symbols.cc diff --git a/node.gyp b/node.gyp index 59573f912eee7e..2ff5f1f12763eb 100644 --- a/node.gyp +++ b/node.gyp @@ -373,6 +373,7 @@ 'src/node_process.cc', 'src/node_serdes.cc', 'src/node_stat_watcher.cc', + 'src/node_symbols.cc', 'src/node_trace_events.cc', 'src/node_types.cc', 'src/node_url.cc', diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc index b46ba5badab226..1d324a5c7659b6 100644 --- a/src/bootstrapper.cc +++ b/src/bootstrapper.cc @@ -135,22 +135,4 @@ void SetupBootstrapObject(Environment* env, } #undef BOOTSTRAP_METHOD -namespace symbols { - -void Initialize(Local target, - Local unused, - Local context, - void* priv) { - Environment* env = Environment::GetCurrent(context); -#define V(PropertyName, StringValue) \ - target->Set(env->context(), \ - env->PropertyName()->Name(), \ - env->PropertyName()).FromJust(); - PER_ISOLATE_SYMBOL_PROPERTIES(V) -#undef V -} - -} // namespace symbols } // namespace node - -NODE_MODULE_CONTEXT_AWARE_INTERNAL(symbols, node::symbols::Initialize) diff --git a/src/node_symbols.cc b/src/node_symbols.cc new file mode 100644 index 00000000000000..36289b9f4148ae --- /dev/null +++ b/src/node_symbols.cc @@ -0,0 +1,29 @@ +#include "env-inl.h" +#include "node_binding.h" + +namespace node { + +using v8::Context; +using v8::Local; +using v8::Object; +using v8::Value; + +namespace symbols { + +static void Initialize(Local target, + Local unused, + Local context, + void* priv) { + Environment* env = Environment::GetCurrent(context); +#define V(PropertyName, StringValue) \ + target \ + ->Set(env->context(), env->PropertyName()->Name(), env->PropertyName()) \ + .FromJust(); + PER_ISOLATE_SYMBOL_PROPERTIES(V) +#undef V +} + +} // namespace symbols +} // namespace node + +NODE_MODULE_CONTEXT_AWARE_INTERNAL(symbols, node::symbols::Initialize)