void V8MutationObserver::visitDOMWrapper(void* object, const v8::Persistent<v8::Object>& wrapper, v8::Isolate* isolate)
{
    MutationObserver* observer = static_cast<MutationObserver*>(object);
    HashSet<Node*> observedNodes = observer->getObservedNodes();
    for (HashSet<Node*>::iterator it = observedNodes.begin(); it != observedNodes.end(); ++it) {
        v8::UniqueId id(reinterpret_cast<intptr_t>(V8GCController::opaqueRootForGC(*it, isolate)));
        isolate->SetReferenceFromGroup(id, wrapper);
    }
}
void V8MutationObserver::visitDOMWrapper(v8::Isolate* isolate, ScriptWrappable* scriptWrappable, const v8::Persistent<v8::Object>& wrapper)
{
    MutationObserver* observer = scriptWrappable->toImpl<MutationObserver>();
    HeapHashSet<Member<Node>> observedNodes = observer->getObservedNodes();
    for (HeapHashSet<Member<Node>>::iterator it = observedNodes.begin(); it != observedNodes.end(); ++it) {
        v8::UniqueId id(reinterpret_cast<intptr_t>(V8GCController::opaqueRootForGC(isolate, *it)));
        isolate->SetReferenceFromGroup(id, wrapper);
    }
}
Esempio n. 3
0
bool JSMutationObserverOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
    MutationObserver* observer = jsCast<JSMutationObserver*>(handle.get().asCell())->impl();
    HashSet<Node*> observedNodes = observer->getObservedNodes();
    for (HashSet<Node*>::iterator it = observedNodes.begin(); it != observedNodes.end(); ++it) {
        if (visitor.containsOpaqueRoot(root(*it)))
            return true;
    }
    return false;
}