Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 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);
         }
     }
 }
Ejemplo n.º 3
0
 void visitDOMWrapper(DOMDataStore* store, T* object, v8::Persistent<v8::Object> wrapper)
 {
     WrapperTypeInfo* typeInfo = V8DOMWrapper::domWrapperType(wrapper);
     if (!S::process(object, wrapper, typeInfo)) {
         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, callback);
         }
     }
 }
Ejemplo n.º 4
0
 void set(PrivateIdentifier* key, v8::Persistent<v8::FunctionTemplate> wrapper)
 {
     ASSERT(!m_map.contains(key));
     m_map.set(key, wrapper);
     wrapper.MakeWeak(key, weakCallback);
 }