| 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/Histogram.h" | 10 #include "platform/Histogram.h" |
| 11 #include "platform/instrumentation/tracing/TraceEvent.h" | 11 #include "platform/instrumentation/tracing/TraceEvent.h" |
| 12 #include "platform/loader/fetch/ResourceFetcher.h" | 12 #include "platform/loader/fetch/ResourceFetcher.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 // Web fonts that laid out more than this number of characters block First | 18 // Web fonts that laid out more than this number of characters block First |
| 19 // Meaningful Paint. | 19 // Meaningful Paint. |
| 20 const int kBlankCharactersThreshold = 200; | 20 const int kBlankCharactersThreshold = 200; |
| 21 | 21 |
| 22 // The page is n-quiet if there are no more than n active network requests for | |
| 23 // this duration of time. | |
| 24 const double kNetwork2QuietWindowSeconds = 3; | |
| 25 const double kNetwork0QuietWindowSeconds = 0.5; | |
| 26 | |
| 27 } // namespace | 22 } // namespace |
| 28 | 23 |
| 29 FirstMeaningfulPaintDetector& FirstMeaningfulPaintDetector::from( | 24 FirstMeaningfulPaintDetector& FirstMeaningfulPaintDetector::from( |
| 30 Document& document) { | 25 Document& document) { |
| 31 return PaintTiming::from(document).firstMeaningfulPaintDetector(); | 26 return PaintTiming::from(document).firstMeaningfulPaintDetector(); |
| 32 } | 27 } |
| 33 | 28 |
| 34 FirstMeaningfulPaintDetector::FirstMeaningfulPaintDetector( | 29 FirstMeaningfulPaintDetector::FirstMeaningfulPaintDetector( |
| 35 PaintTiming* paintTiming, | 30 PaintTiming* paintTiming, |
| 36 Document& document) | 31 Document& document) |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 } else if (m_firstMeaningfulPaint2Quiet) { | 221 } else if (m_firstMeaningfulPaint2Quiet) { |
| 227 hadNetworkQuietHistogram.count(HadNetwork2Quiet); | 222 hadNetworkQuietHistogram.count(HadNetwork2Quiet); |
| 228 } | 223 } |
| 229 } | 224 } |
| 230 | 225 |
| 231 DEFINE_TRACE(FirstMeaningfulPaintDetector) { | 226 DEFINE_TRACE(FirstMeaningfulPaintDetector) { |
| 232 visitor->trace(m_paintTiming); | 227 visitor->trace(m_paintTiming); |
| 233 } | 228 } |
| 234 | 229 |
| 235 } // namespace blink | 230 } // namespace blink |
| OLD | NEW |