void ChildListMutationAccumulator::leaveMutationScope() { ASSERT(m_mutationScopes > 0); if (!--m_mutationScopes) { if (!isEmpty()) enqueueMutationRecord(); accumulatorMap().remove(m_target.get()); } }
PassRefPtr<ChildListMutationAccumulator> ChildListMutationAccumulator::getOrCreate(Node& target) { AccumulatorMap::AddResult result = accumulatorMap().add(&target, nullptr); RefPtr<ChildListMutationAccumulator> accumulator; if (!result.isNewEntry) accumulator = result.storedValue->value; else { accumulator = adoptRef(new ChildListMutationAccumulator(PassRefPtr<Node>(target), MutationObserverInterestGroup::createForChildListMutation(target))); result.storedValue->value = accumulator.get(); } return accumulator.release(); }
ChildListMutationAccumulator::~ChildListMutationAccumulator() { if (!isEmpty()) enqueueMutationRecord(); accumulatorMap().remove(&m_target.get()); }