Exemplo n.º 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);
}
Exemplo n.º 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());
}
Exemplo n.º 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();
}
Exemplo n.º 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();
}
Exemplo n.º 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;
}
Exemplo n.º 8
0
void VTTParser::getNewRegions(HeapVector<Member<VTTRegion>>& outputRegions)
{
    ASSERT(outputRegions.isEmpty());
    outputRegions.swap(m_regionList);
}
Exemplo n.º 9
0
void VTTParser::getNewCues(HeapVector<Member<TextTrackCue>>& outputCues)
{
    ASSERT(outputCues.isEmpty());
    outputCues.swap(m_cueList);
}