Beispiel #1
0
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);
}
Beispiel #3
0
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());
}
Beispiel #4
0
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();
}
Beispiel #5
0
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();
}
Beispiel #6
0
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;
}
Beispiel #8
0
void VTTParser::getNewRegions(HeapVector<Member<VTTRegion>>& outputRegions)
{
    ASSERT(outputRegions.isEmpty());
    outputRegions.swap(m_regionList);
}
Beispiel #9
0
void VTTParser::getNewCues(HeapVector<Member<TextTrackCue>>& outputCues)
{
    ASSERT(outputCues.isEmpty());
    outputCues.swap(m_cueList);
}