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

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

Issue 2528513003: first-paint and first-contentful paint (Closed)
Patch Set: updated PerformanceEntryType size Created 3 years, 11 months 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 660507eee11d03eae3d5bff86da2a268791a26b1..8c7244713aef76efb253000cf6bc1e43d65c364e 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
+++ b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
@@ -157,9 +157,11 @@ PerformanceEntryVector PerformanceBase::getEntriesByType(
if (m_userTiming)
entries.appendVector(m_userTiming->getMeasures());
break;
- // Unsupported for LongTask, TaskAttribution.
+ // Unsupported for Paint, LongTask, TaskAttribution.
// Per the spec, these entries can only be accessed via
// Performance Observer. No separate buffer is maintained.
+ case PerformanceEntry::Paint:
+ break;
case PerformanceEntry::LongTask:
break;
case PerformanceEntry::TaskAttribution:
@@ -403,6 +405,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