PerformanceEntryVector PerformanceObserverEntryList::getEntries() const {
  PerformanceEntryVector entries;

  entries.appendVector(m_performanceEntries);

  std::sort(entries.begin(), entries.end(),
            PerformanceEntry::startTimeCompareLessThan);
  return entries;
}
Пример #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);
}
PerformanceEntryVector PerformanceObserverEntryList::getEntriesByType(
    const String& entryType) {
  PerformanceEntryVector entries;
  PerformanceEntry::EntryType type =
      PerformanceEntry::toEntryTypeEnum(entryType);

  if (type == PerformanceEntry::Invalid)
    return entries;

  for (const auto& entry : m_performanceEntries) {
    if (entry->entryTypeEnum() == type) {
      entries.append(entry);
    }
  }

  std::sort(entries.begin(), entries.end(),
            PerformanceEntry::startTimeCompareLessThan);
  return entries;
}
Пример #4
0
PerformanceEntryVector PerformanceBase::getEntries() const {
  PerformanceEntryVector entries;

  entries.appendVector(m_resourceTimingBuffer);
  if (m_navigationTiming)
    entries.append(m_navigationTiming);
  entries.appendVector(m_frameTimingBuffer);

  if (m_userTiming) {
    entries.appendVector(m_userTiming->getMarks());
    entries.appendVector(m_userTiming->getMeasures());
  }

  std::sort(entries.begin(), entries.end(),
            PerformanceEntry::startTimeCompareLessThan);
  return entries;
}
Пример #5
0
PerformanceEntryVector PerformanceBase::getEntriesByType(
    const String& entryType) {
  PerformanceEntryVector entries;
  PerformanceEntry::EntryType type =
      PerformanceEntry::toEntryTypeEnum(entryType);

  switch (type) {
    case PerformanceEntry::Invalid:
      return entries;
    case PerformanceEntry::LongTask:
      // Unsupported for LongTask. Per the spec, Long task entries can only be
      // accessed via Performance Observer. No separate buffer is maintained.
      return entries;
    case PerformanceEntry::Resource:
      for (const auto& resource : m_resourceTimingBuffer)
        entries.append(resource);
      break;
    case PerformanceEntry::Navigation:
      if (m_navigationTiming)
        entries.append(m_navigationTiming);
      break;
    case PerformanceEntry::Composite:
    case PerformanceEntry::Render:
      for (const auto& frame : m_frameTimingBuffer) {
        if (type == frame->entryTypeEnum()) {
          entries.append(frame);
        }
      }
      break;
    case PerformanceEntry::Mark:
      if (m_userTiming)
        entries.appendVector(m_userTiming->getMarks());
      break;
    case PerformanceEntry::Measure:
      if (m_userTiming)
        entries.appendVector(m_userTiming->getMeasures());
      break;
  }

  std::sort(entries.begin(), entries.end(),
            PerformanceEntry::startTimeCompareLessThan);
  return entries;
}
Пример #6
0
PerformanceEntryVector PerformanceBase::getEntriesByName(
    const String& name,
    const String& entryType) {
  PerformanceEntryVector entries;
  PerformanceEntry::EntryType type =
      PerformanceEntry::toEntryTypeEnum(entryType);

  if (!entryType.isNull() && type == PerformanceEntry::Invalid)
    return entries;

  if (entryType.isNull() || type == PerformanceEntry::Resource) {
    for (const auto& resource : m_resourceTimingBuffer) {
      if (resource->name() == name)
        entries.append(resource);
    }
  }

  if (entryType.isNull() || type == PerformanceEntry::Navigation) {
    if (m_navigationTiming && m_navigationTiming->name() == name)
      entries.append(m_navigationTiming);
  }

  if (entryType.isNull() || type == PerformanceEntry::Composite ||
      type == PerformanceEntry::Render) {
    for (const auto& frame : m_frameTimingBuffer) {
      if (frame->name() == name &&
          (entryType.isNull() || entryType == frame->entryType()))
        entries.append(frame);
    }
  }

  if (m_userTiming) {
    if (entryType.isNull() || type == PerformanceEntry::Mark)
      entries.appendVector(m_userTiming->getMarks(name));
    if (entryType.isNull() || type == PerformanceEntry::Measure)
      entries.appendVector(m_userTiming->getMeasures(name));
  }

  std::sort(entries.begin(), entries.end(),
            PerformanceEntry::startTimeCompareLessThan);
  return entries;
}
Пример #7
0
PerformanceEntryVector Performance::getEntriesByType(const String& entryType)
{
    PerformanceEntryVector entries;

    if (equalIgnoringCase(entryType, "resource"))
        for (PerformanceEntryVector::const_iterator resource = m_resourceTimingBuffer.begin(); resource != m_resourceTimingBuffer.end(); ++resource)
            entries.append(*resource);

    if (m_userTiming) {
        if (equalIgnoringCase(entryType, "mark"))
            entries.appendVector(m_userTiming->getMarks());
        else if (equalIgnoringCase(entryType, "measure"))
            entries.appendVector(m_userTiming->getMeasures());
    }

    std::sort(entries.begin(), entries.end(), PerformanceEntry::startTimeCompareLessThan);
    return entries;
}