From: Timothy J Fontaine Date: Mon, 10 Mar 2014 23:50:00 +0000 (-0700) Subject: Merge remote-tracking branch 'upstream/v0.10' X-Git-Tag: v0.11.12~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b444392a98e66b49dfee8c7e36c59d4e7c6ea1ac;p=platform%2Fupstream%2Fnodejs.git Merge remote-tracking branch 'upstream/v0.10' Conflicts: src/node.cc src/node.js test/message/max_tick_depth_trace.out --- b444392a98e66b49dfee8c7e36c59d4e7c6ea1ac diff --cc lib/timers.js index 644d4c3,db4f5bd..183044a --- a/lib/timers.js +++ b/lib/timers.js @@@ -138,9 -113,15 +138,15 @@@ function listOnTimeout() threw = false; } finally { if (threw) { + // We need to continue processing after domain error handling + // is complete, but not by using whatever domain was left over + // when the timeout threw its exception. + var oldDomain = process.domain; + process.domain = null; process.nextTick(function() { - list.ontimeout(); + list[kOnTimeout](); }); + process.domain = oldDomain; } } } diff --cc src/node.h index d1641f7,199aadf..03cf155 --- a/src/node.h +++ b/src/node.h @@@ -325,78 -217,56 +325,78 @@@ extern "C" NODE_EXTERN void node_module #ifdef _WIN32 # define NODE_MODULE_EXPORT __declspec(dllexport) #else - # define NODE_MODULE_EXPORT /* empty */ + # define NODE_MODULE_EXPORT __attribute__((visibility("default"))) #endif -#define NODE_MODULE(modname, regfunc) \ +#if defined(_MSC_VER) +#pragma section(".CRT$XCU", read) +#define NODE_C_CTOR(fn) \ + static void __cdecl fn(void); \ + __declspec(dllexport, allocate(".CRT$XCU")) \ + void (__cdecl*fn ## _)(void) = fn; \ + static void __cdecl fn(void) +#else +#define NODE_C_CTOR(fn) \ + static void fn(void) __attribute__((constructor)); \ + static void fn(void) +#endif + +#define NODE_MODULE_X(modname, regfunc, priv, flags) \ extern "C" { \ - NODE_MODULE_EXPORT node::node_module_struct modname ## _module = \ + static node::node_module _module = \ { \ - NODE_STANDARD_MODULE_STUFF, \ - (node::addon_register_func)regfunc, \ - NODE_STRINGIFY(modname) \ + NODE_MODULE_VERSION, \ + flags, \ + NULL, \ + __FILE__, \ + (node::addon_register_func) (regfunc), \ + NULL, \ + NODE_STRINGIFY(modname), \ + priv, \ + NULL \ }; \ + NODE_C_CTOR(_register_ ## modname) { \ + node_module_register(&_module); \ + } \ } -#define NODE_MODULE_DECL(modname) \ - extern "C" node::node_module_struct modname ## _module; +#define NODE_MODULE_CONTEXT_AWARE_X(modname, regfunc, priv, flags) \ + extern "C" { \ + static node::node_module _module = \ + { \ + NODE_MODULE_VERSION, \ + flags, \ + NULL, \ + __FILE__, \ + NULL, \ + (node::addon_context_register_func) (regfunc), \ + NODE_STRINGIFY(modname), \ + priv, \ + NULL \ + }; \ + NODE_C_CTOR(_register_ ## modname) { \ + node_module_register(&_module); \ + } \ + } -/* Called after the event loop exits but before the VM is disposed. - * Callbacks are run in reverse order of registration, i.e. newest first. - */ -NODE_EXTERN void AtExit(void (*cb)(void* arg), void* arg = 0); +#define NODE_MODULE(modname, regfunc) \ + NODE_MODULE_X(modname, regfunc, NULL, 0) + +#define NODE_MODULE_CONTEXT_AWARE(modname, regfunc) \ + NODE_MODULE_CONTEXT_AWARE_X(modname, regfunc, NULL, 0) + +#define NODE_MODULE_CONTEXT_AWARE_BUILTIN(modname, regfunc) \ + NODE_MODULE_CONTEXT_AWARE_X(modname, regfunc, NULL, NM_F_BUILTIN) \ /* - * MakeCallback doesn't have a HandleScope. That means the callers scope - * will retain ownership of created handles from MakeCallback and related. - * There is by default a wrapping HandleScope before uv_run, if the caller - * doesn't have a HandleScope on the stack the global will take ownership - * which won't be reaped until the uv loop exits. - * - * If a uv callback is fired, and there is no enclosing HandleScope in the - * cb, you will appear to leak 4-bytes for every invocation. Take heed. + * For backward compatibility in add-on modules. */ +#define NODE_MODULE_DECL /* nothing */ -NODE_EXTERN void SetErrno(uv_err_t err); -NODE_EXTERN v8::Handle -MakeCallback(const v8::Handle object, - const char* method, - int argc, - v8::Handle argv[]); - -NODE_EXTERN v8::Handle -MakeCallback(const v8::Handle object, - const v8::Handle symbol, - int argc, - v8::Handle argv[]); - -NODE_EXTERN v8::Handle -MakeCallback(const v8::Handle object, - const v8::Handle callback, - int argc, - v8::Handle argv[]); +/* Called after the event loop exits but before the VM is disposed. + * Callbacks are run in reverse order of registration, i.e. newest first. + */ +NODE_EXTERN void AtExit(void (*cb)(void* arg), void* arg = 0); } // namespace node