| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 47cd49a commit 9c7a42a
35 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -815,6 +815,7 @@ | |||
| 815 | 815 | 'defines': [ 'NODE_WANT_INTERNALS=1' ], | |
| 816 | 816 | ||
| 817 | 817 | 'sources': [ | |
| 818 | + 'test/cctest/node_module_reg.cc', | ||
| 818 | 819 | 'test/cctest/node_test_fixture.cc', | |
| 819 | 820 | 'test/cctest/test_aliased_buffer.cc', | |
| 820 | 821 | 'test/cctest/test_base64.cc', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -831,4 +831,4 @@ void EmitAsyncDestroy(Isolate* isolate, async_context asyncContext) { | |||
| 831 | 831 | ||
| 832 | 832 | } // namespace node | |
| 833 | 833 | ||
| 834 | - NODE_MODULE_CONTEXT_AWARE_BUILTIN(async_wrap, node::AsyncWrap::Initialize) | ||
| 834 | + NODE_BUILTIN_MODULE_CONTEXT_AWARE(async_wrap, node::AsyncWrap::Initialize) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2259,4 +2259,4 @@ void Initialize(Local<Object> target, | |||
| 2259 | 2259 | } // namespace cares_wrap | |
| 2260 | 2260 | } // namespace node | |
| 2261 | 2261 | ||
| 2262 | - NODE_MODULE_CONTEXT_AWARE_BUILTIN(cares_wrap, node::cares_wrap::Initialize) | ||
| 2262 | + NODE_BUILTIN_MODULE_CONTEXT_AWARE(cares_wrap, node::cares_wrap::Initialize) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -221,4 +221,4 @@ void FSEventWrap::Close(const FunctionCallbackInfo<Value>& args) { | |||
| 221 | 221 | } // anonymous namespace | |
| 222 | 222 | } // namespace node | |
| 223 | 223 | ||
| 224 | - NODE_MODULE_CONTEXT_AWARE_BUILTIN(fs_event_wrap, node::FSEventWrap::Initialize) | ||
| 224 | + NODE_BUILTIN_MODULE_CONTEXT_AWARE(fs_event_wrap, node::FSEventWrap::Initialize) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -348,5 +348,5 @@ void InitInspectorBindings(Local<Object> target, Local<Value> unused, | |||
| 348 | 348 | } // namespace inspector | |
| 349 | 349 | } // namespace node | |
| 350 | 350 | ||
| 351 | - NODE_MODULE_CONTEXT_AWARE_BUILTIN(inspector, | ||
| 351 | + NODE_BUILTIN_MODULE_CONTEXT_AWARE(inspector, | ||
| 352 | 352 | node::inspector::InitInspectorBindings); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -251,4 +251,4 @@ void JSStream::Initialize(Local<Object> target, | |||
| 251 | 251 | ||
| 252 | 252 | } // namespace node | |
| 253 | 253 | ||
| 254 | - NODE_MODULE_CONTEXT_AWARE_BUILTIN(js_stream, node::JSStream::Initialize) | ||
| 254 | + NODE_BUILTIN_MODULE_CONTEXT_AWARE(js_stream, node::JSStream::Initialize) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -123,6 +123,16 @@ typedef int mode_t; | |||
| 123 | 123 | extern char **environ; | |
| 124 | 124 | #endif | |
| 125 | 125 | ||
| 126 | + // This is used to load built-in modules. Instead of using | ||
| 127 | + // __attribute__((constructor)), we call the _register_<modname> | ||
| 128 | + // function for each built-in modules explicitly in | ||
| 129 | + // node::RegisterBuiltinModules(). This is only forward declaration. | ||
| 130 | + // The definitions are in each module's implementation when calling | ||
| 131 | + // the NODE_BUILTIN_MODULE_CONTEXT_AWARE. | ||
| 132 | + #define V(modname) void _register_##modname(); | ||
| 133 | + NODE_BUILTIN_MODULES(V) | ||
| 134 | + #undef V | ||
| 135 | + | ||
| 126 | 136 | namespace node { | |
| 127 | 137 | ||
| 128 | 138 | using v8::Array; | |
@@ -4575,6 +4585,9 @@ void Init(int* argc, | |||
| 4575 | 4585 | // Initialize prog_start_time to get relative uptime. | |
| 4576 | 4586 | prog_start_time = static_cast<double>(uv_now(uv_default_loop())); | |
| 4577 | 4587 | ||
| 4588 | + // Register built-in modules | ||
| 4589 | + node::RegisterBuiltinModules(); | ||
| 4590 | + | ||
| 4578 | 4591 | // Make inherited handles noninheritable. | |
| 4579 | 4592 | uv_disable_stdio_inheritance(); | |
| 4580 | 4593 | ||
@@ -4984,11 +4997,18 @@ int Start(int argc, char** argv) { | |||
| 4984 | 4997 | return exit_code; | |
| 4985 | 4998 | } | |
| 4986 | 4999 | ||
| 5000 | + // Call built-in modules' _register_<module name> function to | ||
| 5001 | + // do module registration explicitly. | ||
| 5002 | + void RegisterBuiltinModules() { | ||
| 5003 | + #define V(modname) _register_##modname(); | ||
| 5004 | + NODE_BUILTIN_MODULES(V) | ||
| 5005 | + #undef V | ||
| 5006 | + } | ||
| 4987 | 5007 | ||
| 4988 | 5008 | } // namespace node | |
| 4989 | 5009 | ||
| 4990 | 5010 | #if !HAVE_INSPECTOR | |
| 4991 | - static void InitEmptyBindings() {} | ||
| 5011 | + void InitEmptyBindings() {} | ||
| 4992 | 5012 | ||
| 4993 | - NODE_MODULE_CONTEXT_AWARE_BUILTIN(inspector, InitEmptyBindings) | ||
| 5013 | + NODE_BUILTIN_MODULE_CONTEXT_AWARE(inspector, InitEmptyBindings) | ||
| 4994 | 5014 | #endif // !HAVE_INSPECTOR | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1304,4 +1304,4 @@ void Initialize(Local<Object> target, | |||
| 1304 | 1304 | } // namespace Buffer | |
| 1305 | 1305 | } // namespace node | |
| 1306 | 1306 | ||
| 1307 | - NODE_MODULE_CONTEXT_AWARE_BUILTIN(buffer, node::Buffer::Initialize) | ||
| 1307 | + NODE_BUILTIN_MODULE_CONTEXT_AWARE(buffer, node::Buffer::Initialize) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -132,4 +132,4 @@ static void InitConfig(Local<Object> target, | |||
| 132 | 132 | ||
| 133 | 133 | } // namespace node | |
| 134 | 134 | ||
| 135 | - NODE_MODULE_CONTEXT_AWARE_BUILTIN(config, node::InitConfig) | ||
| 135 | + NODE_BUILTIN_MODULE_CONTEXT_AWARE(config, node::InitConfig) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1171,4 +1171,4 @@ void InitContextify(Local<Object> target, | |||
| 1171 | 1171 | } // anonymous namespace | |
| 1172 | 1172 | } // namespace node | |
| 1173 | 1173 | ||
| 1174 | - NODE_MODULE_CONTEXT_AWARE_BUILTIN(contextify, node::InitContextify) | ||
| 1174 | + NODE_BUILTIN_MODULE_CONTEXT_AWARE(contextify, node::InitContextify) | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments