PageRenderTime 20ms CodeModel.GetById 8ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 1ms

/c_src/erlv8_internal.cc

http://github.com/beamjs/erlv8
C++ | 22 lines | 19 code | 3 blank | 0 comment | 1 complexity | bda7d40d56bddae83874d5fd9dc0543d MD5 | raw file
 1#include "erlv8.hh"
 2
 3TickHandler(InternalCountTickHandler) {
 4  ErlNifEnv *ref_env = enif_alloc_env();
 5  ERL_NIF_TERM get_ref = enif_make_copy(ref_env, tick_ref);
 6  val_res_t *obj_res;
 7  if (enif_get_resource(vm->env,array[1],val_resource,(void **)(&obj_res))) {
 8    LHCS(vm->isolate, obj_res->ctx);
 9	
10    int ifc = obj_res->val->ToObject()->InternalFieldCount();
11    
12    SEND(vm->server,
13	 enif_make_tuple3(env,
14			  enif_make_atom(env,"result"),
15			  enif_make_copy(env,get_ref),
16			  enif_make_int(env, ifc)));
17  } 
18  enif_free_env(ref_env);
19  TickHandlerResolution result;
20  result.type = DONE;
21  return result;
22}