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

Side by Side Diff: third_party/WebKit/Source/core/paint/FirstMeaningfulPaintDetector.cpp

Issue 2710623002: Enforce FirstContentfulPaint <= FirstMeaningfulPaint (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/FirstMeaningfulPaintDetectorTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/paint/FirstMeaningfulPaintDetector.h" 5 #include "core/paint/FirstMeaningfulPaintDetector.h"
6 6
7 #include "core/css/FontFaceSet.h" 7 #include "core/css/FontFaceSet.h"
8 #include "core/dom/TaskRunnerHelper.h" 8 #include "core/dom/TaskRunnerHelper.h"
9 #include "core/paint/PaintTiming.h" 9 #include "core/paint/PaintTiming.h"
10 #include "platform/instrumentation/tracing/TraceEvent.h" 10 #include "platform/instrumentation/tracing/TraceEvent.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 m_networkStableTimer.startOneShot(kSecondsWithoutNetworkActivityThreshold, 115 m_networkStableTimer.startOneShot(kSecondsWithoutNetworkActivityThreshold,
116 BLINK_FROM_HERE); 116 BLINK_FROM_HERE);
117 } 117 }
118 118
119 void FirstMeaningfulPaintDetector::networkStableTimerFired(TimerBase*) { 119 void FirstMeaningfulPaintDetector::networkStableTimerFired(TimerBase*) {
120 if (m_state == Reported || !document() || 120 if (m_state == Reported || !document() ||
121 document()->fetcher()->hasPendingRequest() || 121 document()->fetcher()->hasPendingRequest() ||
122 !m_paintTiming->firstContentfulPaint()) 122 !m_paintTiming->firstContentfulPaint())
123 return; 123 return;
124 124
125 if (m_provisionalFirstMeaningfulPaint) 125 if (m_provisionalFirstMeaningfulPaint) {
126 m_paintTiming->setFirstMeaningfulPaint(m_provisionalFirstMeaningfulPaint); 126 // Enforce FirstContentfulPaint <= FirstMeaningfulPaint.
127 double timestamp = std::max(m_provisionalFirstMeaningfulPaint,
128 m_paintTiming->firstContentfulPaint());
129 m_paintTiming->setFirstMeaningfulPaint(timestamp);
130 }
127 m_state = Reported; 131 m_state = Reported;
128 } 132 }
129 133
130 DEFINE_TRACE(FirstMeaningfulPaintDetector) { 134 DEFINE_TRACE(FirstMeaningfulPaintDetector) {
131 visitor->trace(m_paintTiming); 135 visitor->trace(m_paintTiming);
132 } 136 }
133 137
134 } // namespace blink 138 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/FirstMeaningfulPaintDetectorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698