Print this page
XXX review feedback from keith
XXX error handling cleanup
XXX rework to avoid changing api
XXX well, it works now...
XXX first cut of crosscall
*** 451,469 ****
return (rp);
}
extern "C" nvlist_t *
! v8plus_method_call(void *cop, const char *name, const nvlist_t *lp)
{
v8plus::ObjectWrap *op = v8plus::ObjectWrap::objlookup(cop);
const int max_argc = nvlist_length(lp);
int argc, err;
v8::Handle<v8::Value> argv[max_argc];
v8::Handle<v8::Value> res;
nvlist_t *rp;
argc = max_argc;
nvlist_to_v8_argv(lp, &argc, argv);
if ((err = nvlist_alloc(&rp, NV_UNIQUE_NAME, 0)) != 0)
return (v8plus_nverr(err, NULL));
--- 451,472 ----
return (rp);
}
extern "C" nvlist_t *
! v8plus_method_call_direct(void *cop, const char *name, const nvlist_t *lp)
{
v8plus::ObjectWrap *op = v8plus::ObjectWrap::objlookup(cop);
const int max_argc = nvlist_length(lp);
int argc, err;
v8::Handle<v8::Value> argv[max_argc];
v8::Handle<v8::Value> res;
nvlist_t *rp;
+ if (v8plus_in_event_thread() != _B_TRUE)
+ v8plus_panic("direct method call outside of event loop");
+
argc = max_argc;
nvlist_to_v8_argv(lp, &argc, argv);
if ((err = nvlist_alloc(&rp, NV_UNIQUE_NAME, 0)) != 0)
return (v8plus_nverr(err, NULL));