src: move C++ binding/addon related code into node_binding{.h, .cc}#24701
src: move C++ binding/addon related code into node_binding{.h, .cc}#24701joyeecheung wants to merge 2 commits intonodejs:masterfrom
Conversation
This patch: - Moves the C++ binding/addon related code out of node_internals.h/node.cc and into dedicated files node_binding.h/node_binding.cc, and only puts the code resued by other files into the header. - Introduce a node::binding namespace so that code exposed to other files can be easily recognized.
src/node_binding.cc
Outdated
|
|
||
| // A list of built-in modules. In order to do module registration | ||
| // in node::Init(), need to add built-in modules in the following list. | ||
| // Then in node::RegisterBuiltinModules(), it calls modules' registration |
There was a problem hiding this comment.
| // Then in node::RegisterBuiltinModules(), it calls modules' registration | |
| // Then in binding::RegisterBuiltinModules(), it calls modules' registration |
?
src/node_binding.cc
Outdated
| // This is used to load built-in modules. Instead of using | ||
| // __attribute__((constructor)), we call the _register_<modname> | ||
| // function for each built-in modules explicitly in | ||
| // node::RegisterBuiltinModules(). This is only forward declaration. |
There was a problem hiding this comment.
| // node::RegisterBuiltinModules(). This is only forward declaration. | |
| // binding::RegisterBuiltinModules(). This is only forward declaration. |
?
bnoordhuis
left a comment
There was a problem hiding this comment.
Rubber-stamp LGTM % my and Richard's comments.
src/node_binding.cc
Outdated
| node_module* modlist_linked; | ||
| node_module* modlist_addon; | ||
| uv_once_t init_modpending_once = UV_ONCE_INIT; | ||
| uv_key_t thread_local_modpending; |
There was a problem hiding this comment.
^ These can and should be static, right? They're only used in this compilation unit.
There was a problem hiding this comment.
@bnoordhuis Yes, only node_is_initialized is actually used elsewhere, I'll update
|
Thanks for the reviews, updated. CI: https://ci.nodejs.org/job/node-test-pull-request/19039/ On a side note: thought about moving the static global variables into the |
|
Resume Build CI: https://ci.nodejs.org/job/node-test-pull-request/19052/ (Might benefit from a full CI rebuild to pull in a status file change if the Raspberry Pi rebuild keeps failing...) |
|
The pis were still unhappy. Full rebuild: https://ci.nodejs.org/job/node-test-pull-request/19080/ |
|
I believe the issue with Alpine is resolved now, so let's try CI again: Resume Build CI: https://ci.nodejs.org/job/node-test-pull-request/19102/ |
|
Well, the one Alpine issue seems resolved but the other Alpine host seems to have disconnected or something mid-compilation...once more... Resume Build CI: https://ci.nodejs.org/job/node-test-pull-request/19103/ |
|
Landed in 3d66826 |
This patch: - Moves the C++ binding/addon related code out of node_internals.h/node.cc and into dedicated files node_binding.h/node_binding.cc, and only puts the code resued by other files into the header. - Introduce a node::binding namespace so that code exposed to other files can be easily recognized. PR-URL: nodejs#24701 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
This patch: - Moves the C++ binding/addon related code out of node_internals.h/node.cc and into dedicated files node_binding.h/node_binding.cc, and only puts the code resued by other files into the header. - Introduce a node::binding namespace so that code exposed to other files can be easily recognized. PR-URL: #24701 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
This patch: - Moves the C++ binding/addon related code out of node_internals.h/node.cc and into dedicated files node_binding.h/node_binding.cc, and only puts the code resued by other files into the header. - Introduce a node::binding namespace so that code exposed to other files can be easily recognized. PR-URL: nodejs#24701 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
|
This change does not land cleanly on |
This patch:
node_internals.h/node.cc and into dedicated files
node_binding.h/node_binding.cc, and only puts the code resued
by other files into the header.
other files can be easily recognized.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes