| 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/fetch/ResourceFetcher.h" | 8 #include "core/fetch/ResourceFetcher.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 18 matching lines...) Expand all Loading... |
| 29 } | 29 } |
| 30 | 30 |
| 31 FirstMeaningfulPaintDetector::FirstMeaningfulPaintDetector( | 31 FirstMeaningfulPaintDetector::FirstMeaningfulPaintDetector( |
| 32 PaintTiming* paintTiming) | 32 PaintTiming* paintTiming) |
| 33 : m_paintTiming(paintTiming), | 33 : m_paintTiming(paintTiming), |
| 34 m_networkStableTimer( | 34 m_networkStableTimer( |
| 35 this, | 35 this, |
| 36 &FirstMeaningfulPaintDetector::networkStableTimerFired) {} | 36 &FirstMeaningfulPaintDetector::networkStableTimerFired) {} |
| 37 | 37 |
| 38 Document* FirstMeaningfulPaintDetector::document() { | 38 Document* FirstMeaningfulPaintDetector::document() { |
| 39 return m_paintTiming->document(); | 39 return m_paintTiming->host(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 // Computes "layout significance" (http://goo.gl/rytlPL) of a layout operation. | 42 // Computes "layout significance" (http://goo.gl/rytlPL) of a layout operation. |
| 43 // Significance of a layout is the number of layout objects newly added to the | 43 // Significance of a layout is the number of layout objects newly added to the |
| 44 // layout tree, weighted by page height (before and after the layout). | 44 // layout tree, weighted by page height (before and after the layout). |
| 45 // A paint after the most significance layout during page load is reported as | 45 // A paint after the most significance layout during page load is reported as |
| 46 // First Meaningful Paint. | 46 // First Meaningful Paint. |
| 47 void FirstMeaningfulPaintDetector::markNextPaintAsMeaningfulIfNeeded( | 47 void FirstMeaningfulPaintDetector::markNextPaintAsMeaningfulIfNeeded( |
| 48 const LayoutObjectCounter& counter, | 48 const LayoutObjectCounter& counter, |
| 49 int contentsHeightBeforeLayout, | 49 int contentsHeightBeforeLayout, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 if (m_provisionalFirstMeaningfulPaint) | 122 if (m_provisionalFirstMeaningfulPaint) |
| 123 m_paintTiming->setFirstMeaningfulPaint(m_provisionalFirstMeaningfulPaint); | 123 m_paintTiming->setFirstMeaningfulPaint(m_provisionalFirstMeaningfulPaint); |
| 124 m_state = Reported; | 124 m_state = Reported; |
| 125 } | 125 } |
| 126 | 126 |
| 127 DEFINE_TRACE(FirstMeaningfulPaintDetector) { | 127 DEFINE_TRACE(FirstMeaningfulPaintDetector) { |
| 128 visitor->trace(m_paintTiming); | 128 visitor->trace(m_paintTiming); |
| 129 } | 129 } |
| 130 | 130 |
| 131 } // namespace blink | 131 } // namespace blink |
| OLD | NEW |