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

Side by Side Diff: chrome/browser/prerender/prerender_histograms.h

Issue 2423383002: [Prerender] first contentful paint histograms. (Closed)
Patch Set: cleanup Created 4 years, 1 month 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_ 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_ 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 PrerenderHistograms(); 45 PrerenderHistograms();
46 46
47 // Records the perceived page load time for a page - effectively the time from 47 // Records the perceived page load time for a page - effectively the time from
48 // when the user navigates to a page to when it finishes loading. The actual 48 // when the user navigates to a page to when it finishes loading. The actual
49 // load may have started prior to navigation due to prerender hints. 49 // load may have started prior to navigation due to prerender hints.
50 void RecordPerceivedPageLoadTime(Origin origin, 50 void RecordPerceivedPageLoadTime(Origin origin,
51 base::TimeDelta perceived_page_load_time, 51 base::TimeDelta perceived_page_load_time,
52 NavigationType navigation_type, 52 NavigationType navigation_type,
53 const GURL& url); 53 const GURL& url);
54 54
55 // Record perceived first contentful paint time for prerendered pages,
56 // analogous to the page load time above.
pasko 2016/11/17 19:52:16 let's copy the relevant parts of the comment from
mattcary 2016/11/18 09:21:11 Done.
57 void RecordPerceivedFirstContentfulPaintTime(
58 Origin origin,
59 base::TimeDelta perceived_first_contentful_paint);
60
61 // Record that a first contentful paint occured, and whether we were able to
62 // successfuly record the perceived FCP.
63 void RecordPerceivedFirstContentfulPaintStatus(Origin origin,
64 bool successful);
65
55 // Records, in a histogram, the percentage of the page load time that had 66 // Records, in a histogram, the percentage of the page load time that had
56 // elapsed by the time it is swapped in. Values outside of [0, 1.0] are 67 // elapsed by the time it is swapped in. Values outside of [0, 1.0] are
57 // invalid and ignored. 68 // invalid and ignored.
58 void RecordPercentLoadDoneAtSwapin(Origin origin, double fraction) const; 69 void RecordPercentLoadDoneAtSwapin(Origin origin, double fraction) const;
59 70
60 // Records the actual pageload time of a prerender that has not been swapped 71 // Records the actual pageload time of a prerender that has not been swapped
61 // in yet, but finished loading. 72 // in yet, but finished loading.
62 void RecordPageLoadTimeNotSwappedIn(Origin origin, 73 void RecordPageLoadTimeNotSwappedIn(Origin origin,
63 base::TimeDelta page_load_time, 74 base::TimeDelta page_load_time,
64 const GURL& url) const; 75 const GURL& url) const;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 bool is_main_resource, 125 bool is_main_resource,
115 bool is_redirect, 126 bool is_redirect,
116 bool is_no_store) const; 127 bool is_no_store) const;
117 128
118 // Called when a NoStatePrefetch resource has been loaded. This is called only 129 // Called when a NoStatePrefetch resource has been loaded. This is called only
119 // once per resource, when all redirects have been resolved. 130 // once per resource, when all redirects have been resolved.
120 void RecordPrefetchRedirectCount(Origin origin, 131 void RecordPrefetchRedirectCount(Origin origin,
121 bool is_main_resource, 132 bool is_main_resource,
122 int redirect_count) const; 133 int redirect_count) const;
123 134
124 // Records the time to first contentful paint. 135 // Records the time to first contentful paint in the context of NoState
125 // Must not be called for prefetch loads (which are never rendered anyway). 136 // Prefetch.
137
138 // Must be called for an actual page load, and not be called for prefetch
139 // loads (which are never rendered anyway).
126 // |is_no_store| must be true if the main resource has a "no-store" cache 140 // |is_no_store| must be true if the main resource has a "no-store" cache
127 // control HTTP header. 141 // control HTTP header.
128 // |prefetch_age| must be zero if the page was not prefetched. 142 // |prefetch_age| must be zero if the page was not prefetched.
129 void RecordFirstContentfulPaint(Origin origin, 143 void RecordNoStateFirstContentfulPaint(Origin origin,
130 bool is_no_store, 144 bool is_no_store,
131 base::TimeDelta time, 145 base::TimeDelta time,
132 base::TimeDelta prefetch_age); 146 base::TimeDelta prefetch_age);
133 147
134 // Returns the name of the histogram used to record the time to first 148 // Returns the name of the histogram used to record the time to first
135 // contentful paint. 149 // contentful paint for NoState Prefetch.
136 // Exposed for testing. 150 // Exposed for testing.
137 static std::string GetFirstContentfulPaintHistogramName( 151 static std::string GetNoStateFirstContentfulPaintHistogramName(
pasko 2016/11/17 19:52:16 It would be better to make this method private and
mattcary 2016/11/18 09:21:11 What I've done here is consistent with how the oth
138 Origin origin, 152 Origin origin,
139 bool is_wash, 153 bool is_wash,
140 bool is_no_store, 154 bool is_no_store,
141 base::TimeDelta prefetch_age); 155 base::TimeDelta prefetch_age);
142 156
143 private: 157 private:
158 // Returns the name of the histogram used to record the time to first
159 // contentful paint for Prerender.
160 std::string GetPerceivedFirstContentfulPaintHistogramName(Origin origin,
161 bool is_wash);
162
144 base::TimeTicks GetCurrentTimeTicks() const; 163 base::TimeTicks GetCurrentTimeTicks() const;
145 164
146 // Returns the time elapsed since the last prerender happened. 165 // Returns the time elapsed since the last prerender happened.
147 base::TimeDelta GetTimeSinceLastPrerender() const; 166 base::TimeDelta GetTimeSinceLastPrerender() const;
148 167
149 // Returns whether the PrerenderManager is currently within the prerender 168 // Returns whether the PrerenderManager is currently within the prerender
150 // window - effectively, up to 30 seconds after a prerender tag has been 169 // window - effectively, up to 30 seconds after a prerender tag has been
151 // observed. 170 // observed.
152 bool WithinWindow() const; 171 bool WithinWindow() const;
153 172
(...skipping 19 matching lines...) Expand all
173 bool seen_pageload_started_after_prerender_; 192 bool seen_pageload_started_after_prerender_;
174 193
175 base::ThreadChecker thread_checker_; 194 base::ThreadChecker thread_checker_;
176 195
177 DISALLOW_COPY_AND_ASSIGN(PrerenderHistograms); 196 DISALLOW_COPY_AND_ASSIGN(PrerenderHistograms);
178 }; 197 };
179 198
180 } // namespace prerender 199 } // namespace prerender
181 200
182 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_ 201 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698