コード例 #1
0
ファイル: V8GCController.cpp プロジェクト: kanongil/webkit
 static bool process(void* object, v8::Persistent<v8::Object> wrapper, WrapperTypeInfo* typeInfo)
 {
     if (V8MessagePort::info.equals(typeInfo)) {
         MessagePort* port1 = static_cast<MessagePort*>(object);
         // We marked this port as reachable in GCPrologueVisitor.  Undo this now since the
         // port could be not reachable in the future if it gets disentangled (and also
         // GCPrologueVisitor expects to see all handles marked as weak).
         if ((!wrapper.IsWeak() && !wrapper.IsNearDeath()) || port1->hasPendingActivity())
             wrapper.MakeWeak(port1, &DOMDataStore::weakActiveDOMObjectCallback);
         return true;
     }
     return false;
 }
コード例 #2
0
ファイル: ObjectWrap.cpp プロジェクト: cha0s/avocado-spi-v8
void ObjectWrap::WeakCallback(v8::Isolate* env, v8::Persistent<v8::Value> value, void *data) {
	v8::HandleScope scope(V8::avocadoIsolate);

	// Get coherence back.
	ObjectWrap *obj = static_cast<ObjectWrap *>(data);

	// This is us, and GC ran?
	assert(value == obj->handle_);
	assert(value.IsNearDeath(env));

	// Kill this.
	delete obj;
}
コード例 #3
0
ファイル: V8GCController.cpp プロジェクト: sinoory/webv8
 void visitDOMWrapper(DOMDataStore* store, void* object, v8::Persistent<v8::Object> wrapper)
 {
     WrapperTypeInfo* typeInfo = V8DOMWrapper::domWrapperType(wrapper);
     if (V8MessagePort::info.equals(typeInfo)) {
         MessagePort* port1 = static_cast<MessagePort*>(object);
         // We marked this port as reachable in GCPrologueVisitor.  Undo this now since the
         // port could be not reachable in the future if it gets disentangled (and also
         // GCPrologueVisitor expects to see all handles marked as weak).
         if ((!wrapper.IsWeak() && !wrapper.IsNearDeath()) || port1->hasPendingActivity())
             wrapper.MakeWeak(port1, &DOMDataStore::weakActiveDOMObjectCallback);
     } else {
         ActiveDOMObject* activeDOMObject = typeInfo->toActiveDOMObject(wrapper);
         if (activeDOMObject && activeDOMObject->hasPendingActivity()) {
             ASSERT(!wrapper.IsWeak());
             // NOTE: To re-enable weak status of the active object we use
             // |object| from the map and not |activeDOMObject|. The latter
             // may be a different pointer (in case ActiveDOMObject is not
             // the main base class of the object's class) and pointer
             // identity is required by DOM map functions.
             wrapper.MakeWeak(object, &DOMDataStore::weakActiveDOMObjectCallback);
         }
     }
 }