PageRenderTime 25ms CodeModel.GetById 17ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/c_src/erlv8_result.cc

http://github.com/beamjs/erlv8
C++ | 24 lines | 19 code | 5 blank | 0 comment | 2 complexity | 9533c868991fe79f8221316644c16bc8 MD5 | raw file
 1#include "erlv8.hh"
 2
 3TickHandler(ResultTickHandler) {
 4  v8::HandleScope handle_scope;
 5  TickHandlerResolution result;
 6  
 7  if (((unsigned long) ref) &&
 8      (enif_is_identical(array[1],ref))) { // this is our result
 9    result.value = handle_scope.Close(term_to_js(vm->context, vm->isolate, vm->env,array[2]));
10    result.type = RETURN;
11    return result;
12  } else {
13    Tick newtick;
14    
15    newtick.env = enif_alloc_env();
16    newtick.tick = enif_make_copy(newtick.env, tick);
17    newtick.ref = enif_make_copy(newtick.env, tick_ref);
18    
19    vm->pop_ticks.push(newtick);
20
21    result.type = DONE;    
22    return result;
23  }
24}