void MediaRecorder::dispatchScheduledEvent() { HeapVector<Member<Event>> events; events.swap(m_scheduledEvents); for (const auto& event : events) dispatchEvent(event); }
void IntersectionObserver::deliver() { if (m_entries.isEmpty()) return; HeapVector<Member<IntersectionObserverEntry>> entries; entries.swap(m_entries); m_callback->handleEvent(entries, *this); }
void RTCDTMFSender::scheduledEventTimerFired(TimerBase*) { if (m_stopped) return; HeapVector<Member<Event>> events; events.swap(m_scheduledEvents); HeapVector<Member<Event>>::iterator it = events.begin(); for (; it != events.end(); ++it) dispatchEvent((*it).release()); }
void RTCDataChannel::scheduledEventTimerFired(Timer<RTCDataChannel>*) { HeapVector<Member<Event>> events; events.swap(m_scheduledEvents); HeapVector<Member<Event>>::iterator it = events.begin(); for (; it != events.end(); ++it) dispatchEvent((*it).release()); events.clear(); }
void MediaStream::scheduledEventTimerFired(TimerBase*) { if (m_executionContext->isContextDestroyed()) return; HeapVector<Member<Event>> events; events.swap(m_scheduledEvents); HeapVector<Member<Event>>::iterator it = events.begin(); for (; it != events.end(); ++it) dispatchEvent((*it).release()); events.clear(); }
void HTMLFormattingElementList::ensureNoahsArkCondition( HTMLStackItem* newItem) { HeapVector<Member<HTMLStackItem>> candidates; tryToEnsureNoahsArkConditionQuickly(newItem, candidates); if (candidates.isEmpty()) return; // We pre-allocate and re-use this second vector to save one malloc per // attribute that we verify. HeapVector<Member<HTMLStackItem>> remainingCandidates; remainingCandidates.reserveInitialCapacity(candidates.size()); for (const auto& attribute : newItem->attributes()) { for (const auto& candidate : candidates) { // These properties should already have been checked by // tryToEnsureNoahsArkConditionQuickly. ASSERT(newItem->attributes().size() == candidate->attributes().size()); ASSERT(newItem->localName() == candidate->localName() && newItem->namespaceURI() == candidate->namespaceURI()); Attribute* candidateAttribute = candidate->getAttributeItem(attribute.name()); if (candidateAttribute && candidateAttribute->value() == attribute.value()) remainingCandidates.append(candidate); } if (remainingCandidates.size() < kNoahsArkCapacity) return; candidates.swap(remainingCandidates); remainingCandidates.shrink(0); } // Inductively, we shouldn't spin this loop very many times. It's possible, // however, that we wil spin the loop more than once because of how the // formatting element list gets permuted. for (size_t i = kNoahsArkCapacity - 1; i < candidates.size(); ++i) remove(candidates[i]->element()); }
HeapVector<Member<IntersectionObserverEntry>> IntersectionObserver::takeRecords() { HeapVector<Member<IntersectionObserverEntry>> entries; entries.swap(m_entries); return entries; }
void VTTParser::getNewRegions(HeapVector<Member<VTTRegion>>& outputRegions) { ASSERT(outputRegions.isEmpty()); outputRegions.swap(m_regionList); }
void VTTParser::getNewCues(HeapVector<Member<TextTrackCue>>& outputCues) { ASSERT(outputCues.isEmpty()); outputCues.swap(m_cueList); }