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

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

Issue 2397753006: scheduler: Detect load RAIL mode (Closed)
Patch Set: Add fallback for missing FMP 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 unified diff | Download patch
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/fetch/ResourceFetcher.h" 8 #include "core/fetch/ResourceFetcher.h"
9 #include "core/paint/PaintTiming.h" 9 #include "core/paint/PaintTiming.h"
10 #include "platform/tracing/TraceEvent.h" 10 #include "platform/tracing/TraceEvent.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 if (m_paintTiming->firstPaint() == 0.0) 88 if (m_paintTiming->firstPaint() == 0.0)
89 return; 89 return;
90 90
91 m_provisionalFirstMeaningfulPaint = monotonicallyIncreasingTime(); 91 m_provisionalFirstMeaningfulPaint = monotonicallyIncreasingTime();
92 m_state = NextPaintIsNotMeaningful; 92 m_state = NextPaintIsNotMeaningful;
93 93
94 TRACE_EVENT_MARK_WITH_TIMESTAMP1( 94 TRACE_EVENT_MARK_WITH_TIMESTAMP1(
95 "loading", "firstMeaningfulPaintCandidate", 95 "loading", "firstMeaningfulPaintCandidate",
96 TraceEvent::toTraceTimestamp(m_provisionalFirstMeaningfulPaint), "frame", 96 TraceEvent::toTraceTimestamp(m_provisionalFirstMeaningfulPaint), "frame",
97 document()->frame()); 97 document()->frame());
98 m_paintTiming->markFirstMeaningfulPaintCandidate();
98 } 99 }
99 100
100 void FirstMeaningfulPaintDetector::checkNetworkStable() { 101 void FirstMeaningfulPaintDetector::checkNetworkStable() {
101 DCHECK(document()); 102 DCHECK(document());
102 if (m_state == Reported || document()->fetcher()->hasPendingRequest()) 103 if (m_state == Reported || document()->fetcher()->hasPendingRequest())
103 return; 104 return;
104 105
105 m_networkStableTimer.startOneShot(kSecondsWithoutNetworkActivityThreshold, 106 m_networkStableTimer.startOneShot(kSecondsWithoutNetworkActivityThreshold,
106 BLINK_FROM_HERE); 107 BLINK_FROM_HERE);
107 } 108 }
108 109
109 void FirstMeaningfulPaintDetector::networkStableTimerFired(TimerBase*) { 110 void FirstMeaningfulPaintDetector::networkStableTimerFired(TimerBase*) {
110 if (m_state == Reported || !document() || 111 if (m_state == Reported || !document() ||
111 document()->fetcher()->hasPendingRequest()) 112 document()->fetcher()->hasPendingRequest())
112 return; 113 return;
113 114
114 if (m_provisionalFirstMeaningfulPaint) 115 if (m_provisionalFirstMeaningfulPaint)
115 m_paintTiming->setFirstMeaningfulPaint(m_provisionalFirstMeaningfulPaint); 116 m_paintTiming->setFirstMeaningfulPaint(m_provisionalFirstMeaningfulPaint);
116 m_state = Reported; 117 m_state = Reported;
117 } 118 }
118 119
119 DEFINE_TRACE(FirstMeaningfulPaintDetector) { 120 DEFINE_TRACE(FirstMeaningfulPaintDetector) {
120 visitor->trace(m_paintTiming); 121 visitor->trace(m_paintTiming);
121 } 122 }
122 123
123 } // namespace blink 124 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698