Print this page
XXX review feedback from keith
XXX rework to avoid changing api
XXX well, it works now...


  83                             v8::FunctionTemplate::New(_entry);
  84                         v8::Local<v8::Function> fh = fth->GetFunction();
  85                         mdp = &v8plus_methods[i];
  86 
  87                         _mtbl[i].md_name = function_name(mdp->md_name);
  88                         _mtbl[i].md_c_func = mdp->md_c_func;
  89 
  90                         fh->SetName(v8::String::New(_mtbl[i].md_name));
  91 
  92                         tpl->PrototypeTemplate()->Set(
  93                             v8::String::NewSymbol(mdp->md_name), fh);
  94                 }
  95 
  96                 _constructor =
  97                     v8::Persistent<v8::Function>::New(tpl->GetFunction());
  98 
  99                 target->Set(v8::String::NewSymbol(v8plus_js_factory_name),
 100                     v8::FunctionTemplate::New(
 101                     v8plus::ObjectWrap::cons)->GetFunction());
 102         }


 103 }
 104 
 105 v8::Handle<v8::Value>
 106 v8plus::ObjectWrap::_new(const v8::Arguments &args)
 107 {
 108         v8::HandleScope scope;
 109         v8plus::ObjectWrap *op = new v8plus::ObjectWrap();
 110         nvlist_t *c_excp;
 111         nvlist_t *c_args;
 112 
 113         if ((c_args = v8plus::v8_Arguments_to_nvlist(args)) == NULL)
 114                 return (V8PLUS_THROW_DEFAULT());
 115 
 116         c_excp = v8plus_ctor(c_args, &op->_c_impl);
 117         nvlist_free(c_args);
 118         if (op->_c_impl == NULL) {
 119                 if (c_excp == NULL) {
 120                         return (V8PLUS_THROW_DEFAULT());
 121                 } else {
 122                         return (V8PLUS_THROW_DECORATED(c_excp));




  83                             v8::FunctionTemplate::New(_entry);
  84                         v8::Local<v8::Function> fh = fth->GetFunction();
  85                         mdp = &v8plus_methods[i];
  86 
  87                         _mtbl[i].md_name = function_name(mdp->md_name);
  88                         _mtbl[i].md_c_func = mdp->md_c_func;
  89 
  90                         fh->SetName(v8::String::New(_mtbl[i].md_name));
  91 
  92                         tpl->PrototypeTemplate()->Set(
  93                             v8::String::NewSymbol(mdp->md_name), fh);
  94                 }
  95 
  96                 _constructor =
  97                     v8::Persistent<v8::Function>::New(tpl->GetFunction());
  98 
  99                 target->Set(v8::String::NewSymbol(v8plus_js_factory_name),
 100                     v8::FunctionTemplate::New(
 101                     v8plus::ObjectWrap::cons)->GetFunction());
 102         }
 103 
 104         v8plus_crossthread_init();
 105 }
 106 
 107 v8::Handle<v8::Value>
 108 v8plus::ObjectWrap::_new(const v8::Arguments &args)
 109 {
 110         v8::HandleScope scope;
 111         v8plus::ObjectWrap *op = new v8plus::ObjectWrap();
 112         nvlist_t *c_excp;
 113         nvlist_t *c_args;
 114 
 115         if ((c_args = v8plus::v8_Arguments_to_nvlist(args)) == NULL)
 116                 return (V8PLUS_THROW_DEFAULT());
 117 
 118         c_excp = v8plus_ctor(c_args, &op->_c_impl);
 119         nvlist_free(c_args);
 120         if (op->_c_impl == NULL) {
 121                 if (c_excp == NULL) {
 122                         return (V8PLUS_THROW_DEFAULT());
 123                 } else {
 124                         return (V8PLUS_THROW_DECORATED(c_excp));