| 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 20 matching lines...) Expand all Loading... |
| 31 void reset() { m_count = 0; } | 31 void reset() { m_count = 0; } |
| 32 void increment() { m_count++; } | 32 void increment() { m_count++; } |
| 33 unsigned count() const { return m_count; } | 33 unsigned count() const { return m_count; } |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 unsigned m_count = 0; | 36 unsigned m_count = 0; |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 static FirstMeaningfulPaintDetector& from(Document&); | 39 static FirstMeaningfulPaintDetector& from(Document&); |
| 40 | 40 |
| 41 FirstMeaningfulPaintDetector(PaintTiming*); | 41 FirstMeaningfulPaintDetector(PaintTiming*, Document&); |
| 42 virtual ~FirstMeaningfulPaintDetector() {} | 42 virtual ~FirstMeaningfulPaintDetector() {} |
| 43 | 43 |
| 44 void markNextPaintAsMeaningfulIfNeeded(const LayoutObjectCounter&, | 44 void markNextPaintAsMeaningfulIfNeeded(const LayoutObjectCounter&, |
| 45 int contentsHeightBeforeLayout, | 45 int contentsHeightBeforeLayout, |
| 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 Document* document(); | 56 Document* document(); |
| 57 void networkStableTimerFired(TimerBase*); | 57 void networkStableTimerFired(TimerBase*); |
| 58 | 58 |
| 59 enum State { NextPaintIsNotMeaningful, NextPaintIsMeaningful, Reported }; | 59 enum State { NextPaintIsNotMeaningful, NextPaintIsMeaningful, Reported }; |
| 60 State m_state = NextPaintIsNotMeaningful; | 60 State m_state = NextPaintIsNotMeaningful; |
| 61 | 61 |
| 62 Member<PaintTiming> m_paintTiming; | 62 Member<PaintTiming> m_paintTiming; |
| 63 double m_provisionalFirstMeaningfulPaint = 0.0; | 63 double m_provisionalFirstMeaningfulPaint = 0.0; |
| 64 double m_maxSignificanceSoFar = 0.0; | 64 double m_maxSignificanceSoFar = 0.0; |
| 65 double m_accumulatedSignificanceWhileHavingBlankText = 0.0; | 65 double m_accumulatedSignificanceWhileHavingBlankText = 0.0; |
| 66 unsigned m_prevLayoutObjectCount = 0; | 66 unsigned m_prevLayoutObjectCount = 0; |
| 67 bool m_seenFirstMeaningfulPaintCandidate = false; | 67 bool m_seenFirstMeaningfulPaintCandidate = false; |
| 68 Timer<FirstMeaningfulPaintDetector> m_networkStableTimer; | 68 TaskRunnerTimer<FirstMeaningfulPaintDetector> m_networkStableTimer; |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 } // namespace blink | 71 } // namespace blink |
| 72 | 72 |
| 73 #endif | 73 #endif |
| OLD | NEW |