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

Split Close
Expand all
Collapse all
          --- old/./v8plus_subr.cc
          +++ new/./v8plus_subr.cc
↓ open down ↓ 445 lines elided ↑ open up ↑
 446  446                  }
 447  447          } else if ((err = nvlist_add_v8_Value(rp, "res", res)) != 0) {
 448  448                  nvlist_free(rp);
 449  449                  return (v8plus_nverr(err, "res"));
 450  450          }
 451  451  
 452  452          return (rp);
 453  453  }
 454  454  
 455  455  extern "C" nvlist_t *
 456      -v8plus_method_call(void *cop, const char *name, const nvlist_t *lp)
      456 +v8plus_method_call_direct(void *cop, const char *name, const nvlist_t *lp)
 457  457  {
 458  458          v8plus::ObjectWrap *op = v8plus::ObjectWrap::objlookup(cop);
 459  459          const int max_argc = nvlist_length(lp);
 460  460          int argc, err;
 461  461          v8::Handle<v8::Value> argv[max_argc];
 462  462          v8::Handle<v8::Value> res;
 463  463          nvlist_t *rp;
 464  464  
      465 +        if (v8plus_in_event_thread() != _B_TRUE)
      466 +                v8plus_panic("direct method call outside of event loop");
      467 +
 465  468          argc = max_argc;
 466  469          nvlist_to_v8_argv(lp, &argc, argv);
 467  470  
 468  471          if ((err = nvlist_alloc(&rp, NV_UNIQUE_NAME, 0)) != 0)
 469  472                  return (v8plus_nverr(err, NULL));
 470  473  
 471  474          v8::TryCatch tc;
 472  475          res = op->call(name, argc, argv);
 473  476          if (tc.HasCaught()) {
 474  477                  err = nvlist_add_v8_Value(rp, "err", tc.Exception());
↓ open down ↓ 170 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX