Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Unified Diff: third_party/WebKit/Source/core/timing/PerformanceBase.cpp

Issue 2528513003: first-paint and first-contentful paint (Closed)
Patch Set: addressed comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698