diff --git a/src/node.cc b/src/node.cc index e17baec825..7aba02bd35 100644 --- a/src/node.cc +++ b/src/node.cc @@ -901,9 +901,11 @@ Handle FromConstructorTemplate(Persistent t, Handle MakeDomainCallback(const Handle object, - const Handle callback, - int argc, - Handle argv[]) { + const Handle callback, + int argc, + Handle argv[]) { + // TODO Hook for long stack traces to be made here. + // lazy load _tickDomainCallback if (process_tickDomainCallback.IsEmpty()) { Local cb_v = process->Get(String::New("_tickDomainCallback")); @@ -980,20 +982,11 @@ MakeDomainCallback(const Handle object, Handle MakeCallback(const Handle object, - const Handle symbol, + const Handle callback, int argc, Handle argv[]) { - HandleScope scope; - - Local callback = object->Get(symbol).As(); - Local domain = object->Get(domain_symbol); - // TODO Hook for long stack traces to be made here. - // has domain, off with you - if (!domain->IsNull() && !domain->IsUndefined()) - return scope.Close(MakeDomainCallback(object, callback, argc, argv)); - // lazy load no domain next tick callbacks if (process_tickCallback.IsEmpty()) { Local cb_v = process->Get(String::New("_tickCallback")); @@ -1017,7 +1010,7 @@ MakeCallback(const Handle object, if (tick_infobox.length == 0) { tick_infobox.index = 0; tick_infobox.depth = 0; - return scope.Close(ret); + return ret; } // process nextTicks after call @@ -1028,7 +1021,24 @@ MakeCallback(const Handle object, return Undefined(); } - return scope.Close(ret); + return ret; +} + + +Handle +MakeCallback(const Handle object, + const Handle symbol, + int argc, + Handle argv[]) { + HandleScope scope; + + Local callback = object->Get(symbol).As(); + Local domain = object->Get(domain_symbol); + + // has domain, off with you + if (!domain->IsNull() && !domain->IsUndefined()) + return scope.Close(MakeDomainCallback(object, callback, argc, argv)); + return scope.Close(MakeCallback(object, callback, argc, argv)); }