예제 #1
0
void MutationObserver::deliver() {
  DCHECK(!shouldBeSuspended());

  // Calling clearTransientRegistrations() can modify m_registrations, so it's
  // necessary to make a copy of the transient registrations before operating on
  // them.
  HeapVector<Member<MutationObserverRegistration>, 1> transientRegistrations;
  for (auto& registration : m_registrations) {
    if (registration->hasTransientRegistrations())
      transientRegistrations.append(registration);
  }
  for (size_t i = 0; i < transientRegistrations.size(); ++i)
    transientRegistrations[i]->clearTransientRegistrations();

  if (m_records.isEmpty())
    return;

  MutationRecordVector records;
  records.swap(m_records);

  // Report the first (earliest) stack as the async cause.
  InspectorInstrumentation::AsyncTask asyncTask(
      m_callback->getExecutionContext(), records.first());
  m_callback->call(records, this);
}
예제 #2
0
void PerformanceObserver::deliver() {
  ASSERT(!shouldBeSuspended());

  if (m_performanceEntries.isEmpty())
    return;

  PerformanceEntryVector performanceEntries;
  performanceEntries.swap(m_performanceEntries);
  PerformanceObserverEntryList* entryList =
      new PerformanceObserverEntryList(performanceEntries);
  m_callback->call(m_scriptState.get(), this, entryList, this);
}
예제 #3
0
void MutationObserver::deliver()
{
    ASSERT(!shouldBeSuspended());

    // Calling clearTransientRegistrations() can modify m_registrations, so it's necessary
    // to make a copy of the transient registrations before operating on them.
    WillBeHeapVector<RawPtrWillBeMember<MutationObserverRegistration>, 1> transientRegistrations;
    for (auto& registration : m_registrations) {
        if (registration->hasTransientRegistrations())
            transientRegistrations.append(registration);
    }
    for (size_t i = 0; i < transientRegistrations.size(); ++i)
        transientRegistrations[i]->clearTransientRegistrations();

    if (m_records.isEmpty())
        return;

    MutationRecordVector records;
    records.swap(m_records);

    InspectorInstrumentation::willDeliverMutationRecords(m_callback->executionContext(), this);
    m_callback->call(records, this);
    InspectorInstrumentation::didDeliverMutationRecords(m_callback->executionContext());
}