void MutationObserver::deliver() { ASSERT(canDeliver()); // Calling clearTransientRegistrations() can modify m_registrations, so it's necessary // to make a copy of the transient registrations before operating on them. Vector<RawPtr<MutationObserverRegistration>, 1> transientRegistrations; for (MutationObserverRegistrationSet::iterator iter = m_registrations.begin(); iter != m_registrations.end(); ++iter) { if ((*iter)->hasTransientRegistrations()) transientRegistrations.append(*iter); } for (size_t i = 0; i < transientRegistrations.size(); ++i) transientRegistrations[i]->clearTransientRegistrations(); if (m_records.isEmpty()) return; MutationRecordVector records; records.swap(m_records); m_callback->call(records, this); }
void MutationObserver::deliver() { ASSERT(canDeliver()); // Calling clearTransientRegistrations() can modify m_registrations, so it's necessary // to make a copy of the transient registrations before operating on them. Vector<MutationObserverRegistration*, 1> transientRegistrations; for (auto* registration : m_registrations) { if (registration->hasTransientRegistrations()) transientRegistrations.append(registration); } for (auto& registration : transientRegistrations) registration->clearTransientRegistrations(); if (m_records.isEmpty()) return; Vector<Ref<MutationRecord>> records; records.swap(m_records); m_callback->call(records, this); }