Exemplo n.º 1
0
void NovaNode::DoneWithSuspectCallback(Persistent<Value> suspect, void *paramater) {
	Suspect *s = static_cast<Suspect*>(paramater);
	delete s;	
	suspect.ClearWeak();
	suspect.Dispose();
	suspect.Clear();
}
static void image_map_finalize(Persistent<Value> ctx, void *param) {

	timestep_image_map *map = static_cast<timestep_image_map*>( param );
	timestep_image_delete(map);

	ctx.Dispose();
	ctx.Clear();
}
Exemplo n.º 3
0
void v8_weakref_dispose(Persistent<Value> value, void* data) {
  value.Dispose();
  value.Clear();
  v8_weakref* weakref = (v8_weakref*)data;
  weakref->v8_active = false;
  if (!weakref->rb_active) {
    delete weakref;
  }
}
Exemplo n.º 4
0
	void setPersistentFunc(Persistent<Function>& pf,Handle<Value>& v){
		if(v->IsFunction()){
			if(!pf.IsEmpty()) pf.Dispose();
			pf = Persistent<Function>::New(Handle<Function>::Cast(v));
		}else if(v->IsNull()||v->IsUndefined()){
			if(pf.IsEmpty()) return;
			pf.Dispose();
			pf.Clear();
		}
	}
Exemplo n.º 5
0
extern "C" void disposeHandle(Persistent<Value> object, void* parameter) {
//    cout << "Hello from disposeHandle c++" << endl;
    CALLBACK cleanup = reinterpret_cast<CALLBACK>(reinterpret_cast<long>(parameter));
//    cout << "After the cast" << endl;
	(cleanup)(object);
//    cout << "After the call" << endl;
    object.Dispose();
//    cout << "After the dipose" << endl;
    object.Clear();
//    cout << "After the clear" << endl;
}
Exemplo n.º 6
0
  void DisposeOpenCLObject (Persistent<Value> value, void* release) {
    if (release && value->IsObject()) {
      Local<Object> object = value->ToObject();
      if (object->InternalFieldCount()) {
        void *ptr = object->GetPointerFromInternalField(0);

        int32_t (CALL *clRelease) (void* smth);
        *(void**) &clRelease = release;

        clRelease(ptr); // Returned value is omitted. Check when debugging.
      }
    }

    value.Dispose();
    value.Clear();
  }
Exemplo n.º 7
0
  void HandleEvent (EventHandler* handler) {
    if (handler->f->IsFunction()) {
      Persistent<Function> f = Persistent<Function>::Cast<Value>(handler->f);
      Handle<Value> args[3];
      args[0] = handler->event;
      args[1] = Int32::New(handler->type);
      args[2] = Local<Value>::New(handler->data);
      f->Call(f, 3, args);
      f.Clear();
    }

    handler->f.Dispose();
    handler->f.Clear();
    handler->data.Dispose();
    handler->data.Clear();
    handler->event.Dispose();
    handler->event.Clear();
    delete handler;
  }
Exemplo n.º 8
0
char* ReadLineEditor::CompletionGenerator(const char* text, int state) {
  static unsigned current_index;
  static Persistent<Array> current_completions;
  if (state == 0) {
    i::SmartPointer<char> full_text(i::StrNDup(rl_line_buffer, rl_point));
    HandleScope scope;
    Handle<Array> completions =
      Shell::GetCompletions(String::New(text), String::New(*full_text));
    current_completions = Persistent<Array>::New(completions);
    current_index = 0;
  }
  if (current_index < current_completions->Length()) {
    HandleScope scope;
    Handle<Integer> index = Integer::New(current_index);
    Handle<Value> str_obj = current_completions->Get(index);
    current_index++;
    String::Utf8Value str(str_obj);
    return strdup(*str);
  } else {
    current_completions.Dispose();
    current_completions.Clear();
    return NULL;
  }
}
Exemplo n.º 9
0
void DestroyQuaternionTemplate() {
    QuaternionConstructorTemplate.Clear();
}