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

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

Issue 2423383002: [Prerender] first contentful paint histograms. (Closed)
Patch Set: Generalize internal histogram function name Created 4 years 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, the
56 // time from when the user navigates to a page to when it finishes loading.
57 // The actual load may have started prior to navigation due to prerender
58 // hints.
59 void RecordPerceivedFirstContentfulPaintTime(
60 Origin origin,
61 base::TimeDelta perceived_first_contentful_paint,
62 bool was_hidden);
63
64 // Record that a first contentful paint occured, and whether we were able to
65 // successfuly record the perceived FCP.
66 void RecordPerceivedFirstContentfulPaintStatus(Origin origin,
67 bool successful,
68 bool was_hidden);
69
55 // Records, in a histogram, the percentage of the page load time that had 70 // 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 71 // elapsed by the time it is swapped in. Values outside of [0, 1.0] are
57 // invalid and ignored. 72 // invalid and ignored.
58 void RecordPercentLoadDoneAtSwapin(Origin origin, double fraction) const; 73 void RecordPercentLoadDoneAtSwapin(Origin origin, double fraction) const;
59 74
60 // Records the actual pageload time of a prerender that has not been swapped 75 // Records the actual pageload time of a prerender that has not been swapped
61 // in yet, but finished loading. 76 // in yet, but finished loading.
62 void RecordPageLoadTimeNotSwappedIn(Origin origin, 77 void RecordPageLoadTimeNotSwappedIn(Origin origin,
63 base::TimeDelta page_load_time, 78 base::TimeDelta page_load_time,
64 const GURL& url) const; 79 const GURL& url) const;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 bool is_main_resource, 129 bool is_main_resource,
115 bool is_redirect, 130 bool is_redirect,
116 bool is_no_store) const; 131 bool is_no_store) const;
117 132
118 // Called when a NoStatePrefetch resource has been loaded. This is called only 133 // Called when a NoStatePrefetch resource has been loaded. This is called only
119 // once per resource, when all redirects have been resolved. 134 // once per resource, when all redirects have been resolved.
120 void RecordPrefetchRedirectCount(Origin origin, 135 void RecordPrefetchRedirectCount(Origin origin,
121 bool is_main_resource, 136 bool is_main_resource,
122 int redirect_count) const; 137 int redirect_count) const;
123 138
124 // Records the time to first contentful paint. 139 // 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). 140 // Prefetch.
141
142 // Must be called for an actual page load, and not be called for prefetch
143 // loads (which are never rendered anyway).
126 // |is_no_store| must be true if the main resource has a "no-store" cache 144 // |is_no_store| must be true if the main resource has a "no-store" cache
127 // control HTTP header. 145 // control HTTP header.
128 // |prefetch_age| must be zero if the page was not prefetched. 146 // |prefetch_age| must be zero if the page was not prefetched.
129 void RecordFirstContentfulPaint(Origin origin, 147 void RecordNoStateFirstContentfulPaint(Origin origin,
130 bool is_no_store, 148 bool is_no_store,
131 base::TimeDelta time, 149 base::TimeDelta time,
132 base::TimeDelta prefetch_age); 150 base::TimeDelta prefetch_age);
133 151
134 // Returns the name of the histogram used to record the time to first 152 // Returns the name of the histogram used to record the time to first
135 // contentful paint. 153 // contentful paint for NoState Prefetch.
136 // Exposed for testing. 154 // Exposed for testing.
137 static std::string GetFirstContentfulPaintHistogramName( 155 static std::string GetNoStateFirstContentfulPaintHistogramName(
138 Origin origin, 156 Origin origin,
139 bool is_wash, 157 bool is_wash,
140 bool is_no_store, 158 bool is_no_store,
141 base::TimeDelta prefetch_age); 159 base::TimeDelta prefetch_age);
142 160
143 private: 161 private:
162 // Returns the name of the histogram used to record the time to first
163 // contentful paint for Prerender.
164 static std::string GetPerceivedFirstContentfulPaintHistogramName(
165 Origin origin,
166 bool is_wash,
167 bool was_hidden);
168
169 // The suffix used for FCP visibility.
170 static std::string FirstContentfulPaintHiddenName(bool was_hidden);
171
144 base::TimeTicks GetCurrentTimeTicks() const; 172 base::TimeTicks GetCurrentTimeTicks() const;
145 173
146 // Returns the time elapsed since the last prerender happened. 174 // Returns the time elapsed since the last prerender happened.
147 base::TimeDelta GetTimeSinceLastPrerender() const; 175 base::TimeDelta GetTimeSinceLastPrerender() const;
148 176
149 // Returns whether the PrerenderManager is currently within the prerender 177 // Returns whether the PrerenderManager is currently within the prerender
150 // window - effectively, up to 30 seconds after a prerender tag has been 178 // window - effectively, up to 30 seconds after a prerender tag has been
151 // observed. 179 // observed.
152 bool WithinWindow() const; 180 bool WithinWindow() const;
153 181
(...skipping 19 matching lines...) Expand all
173 bool seen_pageload_started_after_prerender_; 201 bool seen_pageload_started_after_prerender_;
174 202
175 base::ThreadChecker thread_checker_; 203 base::ThreadChecker thread_checker_;
176 204
177 DISALLOW_COPY_AND_ASSIGN(PrerenderHistograms); 205 DISALLOW_COPY_AND_ASSIGN(PrerenderHistograms);
178 }; 206 };
179 207
180 } // namespace prerender 208 } // namespace prerender
181 209
182 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_ 210 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698