From: Ben Noordhuis Date: Thu, 15 Aug 2013 17:22:44 +0000 (+0200) Subject: src: add MakeCallback() that takes an array index X-Git-Tag: v0.11.6~42 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7a3f7780dc9eed1391b389dec82849137ac9d5f5;p=platform%2Fupstream%2Fnodejs.git src: add MakeCallback() that takes an array index Internal helper function for dispatching by array index rather than named property. --- diff --git a/src/node.cc b/src/node.cc index 7b1d843..1d2f905 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1087,6 +1087,23 @@ MakeCallback(const Handle object, } +// Internal only. +Handle +MakeCallback(const Handle object, + uint32_t index, + int argc, + Handle argv[]) { + HandleScope scope(node_isolate); + + Local callback = object->Get(index).As(); + assert(callback->IsFunction()); + + if (using_domains) + return scope.Close(MakeDomainCallback(object, callback, argc, argv)); + return scope.Close(MakeCallback(object, callback, argc, argv)); +} + + Handle MakeCallback(const Handle object, const Handle symbol, diff --git a/src/node_internals.h b/src/node_internals.h index 5e7e65c..ba110a5 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -76,6 +76,12 @@ inline v8::Local PersistentToLocal( v8::Isolate* isolate, const v8::Persistent& persistent); +v8::Handle MakeCallback( + const v8::Handle recv, + uint32_t index, + int argc, + v8::Handle* argv); + template v8::Handle MakeCallback( const v8::Persistent& recv,