mirror of https://github.com/nodejs/node.git
src: add MakeCallback() that takes an array index
Internal helper function for dispatching by array index rather than named property.archived-io.js-v0.10
parent
9c59978f49
commit
7a3f7780dc
17
src/node.cc
17
src/node.cc
|
@ -1087,6 +1087,23 @@ MakeCallback(const Handle<Object> object,
|
|||
}
|
||||
|
||||
|
||||
// Internal only.
|
||||
Handle<Value>
|
||||
MakeCallback(const Handle<Object> object,
|
||||
uint32_t index,
|
||||
int argc,
|
||||
Handle<Value> argv[]) {
|
||||
HandleScope scope(node_isolate);
|
||||
|
||||
Local<Function> callback = object->Get(index).As<Function>();
|
||||
assert(callback->IsFunction());
|
||||
|
||||
if (using_domains)
|
||||
return scope.Close(MakeDomainCallback(object, callback, argc, argv));
|
||||
return scope.Close(MakeCallback(object, callback, argc, argv));
|
||||
}
|
||||
|
||||
|
||||
Handle<Value>
|
||||
MakeCallback(const Handle<Object> object,
|
||||
const Handle<String> symbol,
|
||||
|
|
|
@ -76,6 +76,12 @@ inline v8::Local<TypeName> PersistentToLocal(
|
|||
v8::Isolate* isolate,
|
||||
const v8::Persistent<TypeName>& persistent);
|
||||
|
||||
v8::Handle<v8::Value> MakeCallback(
|
||||
const v8::Handle<v8::Object> recv,
|
||||
uint32_t index,
|
||||
int argc,
|
||||
v8::Handle<v8::Value>* argv);
|
||||
|
||||
template <typename TypeName>
|
||||
v8::Handle<v8::Value> MakeCallback(
|
||||
const v8::Persistent<v8::Object>& recv,
|
||||
|
|
Loading…
Reference in New Issue