Index: third_party/WebKit/Source/core/timing/PerformanceBase.cpp |
diff --git a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp |
index 377a1aed2fef0359fd57b733cf2bb90313c3c678..4d1d299b9ccb440ea6c4e6342ad1447f28fd4f40 100644 |
--- a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp |
+++ b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp |
@@ -89,6 +89,10 @@ PerformanceEntryVector PerformanceBase::getEntries() const { |
entries.appendVector(m_userTiming->getMeasures()); |
} |
+ for (const auto& entry : m_paintTimingBuffer) { |
+ entries.append(entry.value); |
+ } |
+ |
std::sort(entries.begin(), entries.end(), |
PerformanceEntry::startTimeCompareLessThan); |
return entries; |
@@ -115,6 +119,11 @@ PerformanceEntryVector PerformanceBase::getEntriesByType( |
if (m_navigationTiming) |
entries.append(m_navigationTiming); |
break; |
+ case PerformanceEntry::Paint: |
+ for (const auto& entry : m_paintTimingBuffer) { |
+ entries.append(entry.value); |
+ } |
+ break; |
case PerformanceEntry::Composite: |
case PerformanceEntry::Render: |
for (const auto& frame : m_frameTimingBuffer) { |
@@ -160,6 +169,13 @@ PerformanceEntryVector PerformanceBase::getEntriesByName( |
entries.append(m_navigationTiming); |
} |
+ if (entryType.isNull() || type == PerformanceEntry::Paint) { |
+ for (const auto& paintEntry : m_paintTimingBuffer) { |
+ if (paintEntry.value->name() == name) |
+ entries.append(paintEntry.value); |
+ } |
+ } |
+ |
if (entryType.isNull() || type == PerformanceEntry::Composite || |
type == PerformanceEntry::Render) { |
for (const auto& frame : m_frameTimingBuffer) { |
@@ -355,6 +371,22 @@ void PerformanceBase::addNavigationTiming(LocalFrame* frame) { |
notifyObserversOfEntry(*m_navigationTiming); |
} |
+void PerformanceBase::addPaintTiming(PerformancePaintTiming::PaintType type, |
+ double startTime) { |
+ if (!RuntimeEnabledFeatures::performancePaintTimingEnabled()) |
+ return; |
+ PerformanceEntry* entry = new PerformancePaintTiming( |
+ type, monotonicTimeToDOMHighResTimeStamp(startTime)); |
+ notifyObserversOfEntry(*entry); |
+ // Only allow one entry for each type, keep the newest one. |
+ m_paintTimingBuffer.set(PerformancePaintTiming::fromPaintTypeToString(type), |
+ entry); |
+} |
+ |
+void PerformanceBase::clearPaintTimingBuffer() { |
+ m_paintTimingBuffer.clear(); |
+} |
+ |
void PerformanceBase::addResourceTimingBuffer(PerformanceEntry& entry) { |
m_resourceTimingBuffer.append(&entry); |
@@ -535,6 +567,7 @@ DEFINE_TRACE(PerformanceBase) { |
visitor->trace(m_observers); |
visitor->trace(m_activeObservers); |
visitor->trace(m_suspendedObservers); |
+ visitor->trace(m_paintTimingBuffer); |
EventTargetWithInlineData::trace(visitor); |
} |