| 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 #ifndef FirstMeaningfulPaintDetector_h | 5 #ifndef FirstMeaningfulPaintDetector_h |
| 6 #define FirstMeaningfulPaintDetector_h | 6 #define FirstMeaningfulPaintDetector_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "platform/Timer.h" | 9 #include "platform/Timer.h" |
| 10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 int contentsHeightAfterLayout, | 46 int contentsHeightAfterLayout, |
| 47 int visibleHeight); | 47 int visibleHeight); |
| 48 void notifyPaint(); | 48 void notifyPaint(); |
| 49 void checkNetworkStable(); | 49 void checkNetworkStable(); |
| 50 | 50 |
| 51 DECLARE_TRACE(); | 51 DECLARE_TRACE(); |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 friend class FirstMeaningfulPaintDetectorTest; | 54 friend class FirstMeaningfulPaintDetectorTest; |
| 55 | 55 |
| 56 // The page is n-quiet if there are no more than n active network requests for |
| 57 // this duration of time. |
| 58 static constexpr double kNetwork2QuietWindowSeconds = 3; |
| 59 static constexpr double kNetwork0QuietWindowSeconds = 0.5; |
| 60 |
| 56 Document* document(); | 61 Document* document(); |
| 57 int activeConnections(); | 62 int activeConnections(); |
| 58 void setNetworkQuietTimers(int activeConnections); | 63 void setNetworkQuietTimers(int activeConnections); |
| 59 void network0QuietTimerFired(TimerBase*); | 64 void network0QuietTimerFired(TimerBase*); |
| 60 void network2QuietTimerFired(TimerBase*); | 65 void network2QuietTimerFired(TimerBase*); |
| 61 void reportHistograms(); | 66 void reportHistograms(); |
| 62 | 67 |
| 63 bool m_nextPaintIsMeaningful = false; | 68 bool m_nextPaintIsMeaningful = false; |
| 64 | 69 |
| 65 Member<PaintTiming> m_paintTiming; | 70 Member<PaintTiming> m_paintTiming; |
| 66 double m_provisionalFirstMeaningfulPaint = 0.0; | 71 double m_provisionalFirstMeaningfulPaint = 0.0; |
| 67 double m_maxSignificanceSoFar = 0.0; | 72 double m_maxSignificanceSoFar = 0.0; |
| 68 double m_accumulatedSignificanceWhileHavingBlankText = 0.0; | 73 double m_accumulatedSignificanceWhileHavingBlankText = 0.0; |
| 69 unsigned m_prevLayoutObjectCount = 0; | 74 unsigned m_prevLayoutObjectCount = 0; |
| 70 bool m_seenFirstMeaningfulPaintCandidate = false; | 75 bool m_seenFirstMeaningfulPaintCandidate = false; |
| 71 bool m_network0QuietReached = false; | 76 bool m_network0QuietReached = false; |
| 72 bool m_network2QuietReached = false; | 77 bool m_network2QuietReached = false; |
| 73 double m_firstMeaningfulPaint0Quiet = 0.0; | 78 double m_firstMeaningfulPaint0Quiet = 0.0; |
| 74 double m_firstMeaningfulPaint2Quiet = 0.0; | 79 double m_firstMeaningfulPaint2Quiet = 0.0; |
| 75 TaskRunnerTimer<FirstMeaningfulPaintDetector> m_network0QuietTimer; | 80 TaskRunnerTimer<FirstMeaningfulPaintDetector> m_network0QuietTimer; |
| 76 TaskRunnerTimer<FirstMeaningfulPaintDetector> m_network2QuietTimer; | 81 TaskRunnerTimer<FirstMeaningfulPaintDetector> m_network2QuietTimer; |
| 77 }; | 82 }; |
| 78 | 83 |
| 79 } // namespace blink | 84 } // namespace blink |
| 80 | 85 |
| 81 #endif | 86 #endif |
| OLD | NEW |