Browse Source

node: revert removal of MakeCallback

In 0168109 an implementation of MakeCallback was accidently removed. It
has been re-added.
v0.10.1-release
Trevor Norris 12 years ago
committed by Ben Noordhuis
parent
commit
a0867e1c93
  1. 40
      src/node.cc

40
src/node.cc

@ -901,9 +901,11 @@ Handle<Value> FromConstructorTemplate(Persistent<FunctionTemplate> t,
Handle<Value> Handle<Value>
MakeDomainCallback(const Handle<Object> object, MakeDomainCallback(const Handle<Object> object,
const Handle<Function> callback, const Handle<Function> callback,
int argc, int argc,
Handle<Value> argv[]) { Handle<Value> argv[]) {
// TODO Hook for long stack traces to be made here.
// lazy load _tickDomainCallback // lazy load _tickDomainCallback
if (process_tickDomainCallback.IsEmpty()) { if (process_tickDomainCallback.IsEmpty()) {
Local<Value> cb_v = process->Get(String::New("_tickDomainCallback")); Local<Value> cb_v = process->Get(String::New("_tickDomainCallback"));
@ -980,20 +982,11 @@ MakeDomainCallback(const Handle<Object> object,
Handle<Value> Handle<Value>
MakeCallback(const Handle<Object> object, MakeCallback(const Handle<Object> object,
const Handle<String> symbol, const Handle<Function> callback,
int argc, int argc,
Handle<Value> argv[]) { Handle<Value> argv[]) {
HandleScope scope;
Local<Function> callback = object->Get(symbol).As<Function>();
Local<Value> domain = object->Get(domain_symbol);
// TODO Hook for long stack traces to be made here. // 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 // lazy load no domain next tick callbacks
if (process_tickCallback.IsEmpty()) { if (process_tickCallback.IsEmpty()) {
Local<Value> cb_v = process->Get(String::New("_tickCallback")); Local<Value> cb_v = process->Get(String::New("_tickCallback"));
@ -1017,7 +1010,7 @@ MakeCallback(const Handle<Object> object,
if (tick_infobox.length == 0) { if (tick_infobox.length == 0) {
tick_infobox.index = 0; tick_infobox.index = 0;
tick_infobox.depth = 0; tick_infobox.depth = 0;
return scope.Close(ret); return ret;
} }
// process nextTicks after call // process nextTicks after call
@ -1028,7 +1021,24 @@ MakeCallback(const Handle<Object> object,
return Undefined(); return Undefined();
} }
return scope.Close(ret); return ret;
}
Handle<Value>
MakeCallback(const Handle<Object> object,
const Handle<String> symbol,
int argc,
Handle<Value> argv[]) {
HandleScope scope;
Local<Function> callback = object->Get(symbol).As<Function>();
Local<Value> 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));
} }

Loading…
Cancel
Save