Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: third_party/WebKit/Source/core/paint/FirstMeaningfulPaintDetector.h

Issue 2883273003: Move the user interaction policy for FirstMeaningfulPaint UMA into renderer (Closed)
Patch Set: rebase Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 27 matching lines...) Expand all
38 38
39 static FirstMeaningfulPaintDetector& From(Document&); 39 static FirstMeaningfulPaintDetector& From(Document&);
40 40
41 FirstMeaningfulPaintDetector(PaintTiming*, Document&); 41 FirstMeaningfulPaintDetector(PaintTiming*, Document&);
42 virtual ~FirstMeaningfulPaintDetector() {} 42 virtual ~FirstMeaningfulPaintDetector() {}
43 43
44 void MarkNextPaintAsMeaningfulIfNeeded(const LayoutObjectCounter&, 44 void MarkNextPaintAsMeaningfulIfNeeded(const LayoutObjectCounter&,
45 int contents_height_before_layout, 45 int contents_height_before_layout,
46 int contents_height_after_layout, 46 int contents_height_after_layout,
47 int visible_height); 47 int visible_height);
48 void NotifyInputEvent();
48 void NotifyPaint(); 49 void NotifyPaint();
49 void CheckNetworkStable(); 50 void CheckNetworkStable();
50 51
51 DECLARE_TRACE(); 52 DECLARE_TRACE();
52 53
54 enum HadUserInput { kNoUserInput, kHadUserInput, kHadUserInputEnumMax };
55
53 private: 56 private:
54 friend class FirstMeaningfulPaintDetectorTest; 57 friend class FirstMeaningfulPaintDetectorTest;
55 58
56 // The page is n-quiet if there are no more than n active network requests for 59 // The page is n-quiet if there are no more than n active network requests for
57 // this duration of time. 60 // this duration of time.
58 static constexpr double kNetwork2QuietWindowSeconds = 0.5; 61 static constexpr double kNetwork2QuietWindowSeconds = 0.5;
59 static constexpr double kNetwork0QuietWindowSeconds = 0.5; 62 static constexpr double kNetwork0QuietWindowSeconds = 0.5;
60 63
61 Document* GetDocument(); 64 Document* GetDocument();
62 int ActiveConnections(); 65 int ActiveConnections();
63 void SetNetworkQuietTimers(int active_connections); 66 void SetNetworkQuietTimers(int active_connections);
64 void Network0QuietTimerFired(TimerBase*); 67 void Network0QuietTimerFired(TimerBase*);
65 void Network2QuietTimerFired(TimerBase*); 68 void Network2QuietTimerFired(TimerBase*);
66 void ReportHistograms(); 69 void ReportHistograms();
67 70
68 bool next_paint_is_meaningful_ = false; 71 bool next_paint_is_meaningful_ = false;
72 HadUserInput had_user_input_ = kNoUserInput;
73 HadUserInput had_user_input_before_provisional_first_meaningful_paint_ =
74 kNoUserInput;
69 75
70 Member<PaintTiming> paint_timing_; 76 Member<PaintTiming> paint_timing_;
71 double provisional_first_meaningful_paint_ = 0.0; 77 double provisional_first_meaningful_paint_ = 0.0;
72 double max_significance_so_far_ = 0.0; 78 double max_significance_so_far_ = 0.0;
73 double accumulated_significance_while_having_blank_text_ = 0.0; 79 double accumulated_significance_while_having_blank_text_ = 0.0;
74 unsigned prev_layout_object_count_ = 0; 80 unsigned prev_layout_object_count_ = 0;
75 bool seen_first_meaningful_paint_candidate_ = false; 81 bool seen_first_meaningful_paint_candidate_ = false;
76 bool network0_quiet_reached_ = false; 82 bool network0_quiet_reached_ = false;
77 bool network2_quiet_reached_ = false; 83 bool network2_quiet_reached_ = false;
78 double first_meaningful_paint0_quiet_ = 0.0; 84 double first_meaningful_paint0_quiet_ = 0.0;
79 double first_meaningful_paint2_quiet_ = 0.0; 85 double first_meaningful_paint2_quiet_ = 0.0;
80 TaskRunnerTimer<FirstMeaningfulPaintDetector> network0_quiet_timer_; 86 TaskRunnerTimer<FirstMeaningfulPaintDetector> network0_quiet_timer_;
81 TaskRunnerTimer<FirstMeaningfulPaintDetector> network2_quiet_timer_; 87 TaskRunnerTimer<FirstMeaningfulPaintDetector> network2_quiet_timer_;
82 }; 88 };
83 89
84 } // namespace blink 90 } // namespace blink
85 91
86 #endif 92 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698