Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 // If there's only been one contentful paint, then there won't have been | |
| 127 // a meaningful paint signalled to the Scheduler, so mark one now. | |
| 128 // This is a no-op if a FMPC has already been marked. | |
| 129 m_paintTiming->markFirstMeaningfulPaintCandidate(); | |
|
kouhei (in TOK)
2017/03/13 19:22:48
I'm convinced that we need to signal scheduler her
Kunihiko Sakamoto
2017/03/14 01:44:26
Yeah, this would set a non-paint timestamp to Pain
| |
| 126 // Enforce FirstContentfulPaint <= FirstMeaningfulPaint. | 130 // Enforce FirstContentfulPaint <= FirstMeaningfulPaint. |
| 127 double timestamp = std::max(m_provisionalFirstMeaningfulPaint, | 131 double timestamp = std::max(m_provisionalFirstMeaningfulPaint, |
| 128 m_paintTiming->firstContentfulPaint()); | 132 m_paintTiming->firstContentfulPaint()); |
| 129 m_paintTiming->setFirstMeaningfulPaint(timestamp); | 133 m_paintTiming->setFirstMeaningfulPaint(timestamp); |
| 130 } | 134 } |
| 131 m_state = Reported; | 135 m_state = Reported; |
| 132 } | 136 } |
| 133 | 137 |
| 134 DEFINE_TRACE(FirstMeaningfulPaintDetector) { | 138 DEFINE_TRACE(FirstMeaningfulPaintDetector) { |
| 135 visitor->trace(m_paintTiming); | 139 visitor->trace(m_paintTiming); |
| 136 } | 140 } |
| 137 | 141 |
| 138 } // namespace blink | 142 } // namespace blink |
| OLD | NEW |