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 39a7e3029048b737b9dd46be61be55e16c9c23ef..1ccf42e63c9f46114f3bd53a73da62bc77ffb24b 100644 |
--- a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp |
+++ b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp |
@@ -124,9 +124,14 @@ PerformanceEntryVector PerformanceBase::getEntriesByType( |
switch (type) { |
case PerformanceEntry::Invalid: |
return entries; |
+ case PerformanceEntry::Paint: |
+ // Unsupported for Paint. Per the spec, Paint entries |
+ // can only be accessed via Performance Observer. |
+ // No separate buffer is maintained. |
case PerformanceEntry::LongTask: |
- // Unsupported for LongTask. Per the spec, Long task entries can only be |
- // accessed via Performance Observer. No separate buffer is maintained. |
+ // 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) |
@@ -377,6 +382,24 @@ void PerformanceBase::addNavigationTiming(LocalFrame* frame) { |
notifyObserversOfEntry(*m_navigationTiming); |
} |
+void PerformanceBase::addFirstPaintTiming(double startTime) { |
+ addPaintTiming(PerformancePaintTiming::PaintType::FirstPaint, startTime); |
+} |
+ |
+void PerformanceBase::addFirstContentfulPaintTiming(double startTime) { |
+ addPaintTiming(PerformancePaintTiming::PaintType::FirstContentfulPaint, |
+ startTime); |
+} |
+ |
+void PerformanceBase::addPaintTiming(PerformancePaintTiming::PaintType type, |
+ double startTime) { |
+ if (!RuntimeEnabledFeatures::performancePaintTimingEnabled()) |
+ return; |
+ PerformanceEntry* entry = new PerformancePaintTiming( |
+ type, monotonicTimeToDOMHighResTimeStamp(startTime)); |
+ notifyObserversOfEntry(*entry); |
+} |
+ |
void PerformanceBase::addResourceTimingBuffer(PerformanceEntry& entry) { |
m_resourceTimingBuffer.append(&entry); |