OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/renderer/page_load_histograms.h" | 5 #include "chrome/renderer/page_load_histograms.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
11 #include "chrome/common/chrome_constants.h" | 11 #include "chrome/common/chrome_constants.h" |
12 #include "chrome/common/extensions/url_pattern.h" | 12 #include "chrome/common/extensions/url_pattern.h" |
13 #include "chrome/renderer/chrome_content_renderer_client.h" | 13 #include "chrome/renderer/chrome_content_renderer_client.h" |
14 #include "chrome/renderer/prerender/prerender_helper.h" | 14 #include "chrome/renderer/prerender/prerender_helper.h" |
15 #include "chrome/renderer/renderer_histogram_snapshots.h" | 15 #include "chrome/renderer/renderer_histogram_snapshots.h" |
16 #include "content/public/renderer/navigation_state.h" | 16 #include "content/public/renderer/document_state.h" |
17 #include "content/public/renderer/render_view.h" | 17 #include "content/public/renderer/render_view.h" |
18 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPerformance.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPerformance.h" |
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" |
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
24 | 24 |
25 using WebKit::WebDataSource; | 25 using WebKit::WebDataSource; |
26 using WebKit::WebFrame; | 26 using WebKit::WebFrame; |
27 using WebKit::WebPerformance; | 27 using WebKit::WebPerformance; |
28 using WebKit::WebString; | 28 using WebKit::WebString; |
29 using base::Time; | 29 using base::Time; |
30 using base::TimeDelta; | 30 using base::TimeDelta; |
31 using content::NavigationState; | 31 using content::DocumentState; |
32 | 32 |
33 static const TimeDelta kPLTMin(TimeDelta::FromMilliseconds(10)); | 33 static const TimeDelta kPLTMin(TimeDelta::FromMilliseconds(10)); |
34 static const TimeDelta kPLTMax(TimeDelta::FromMinutes(10)); | 34 static const TimeDelta kPLTMax(TimeDelta::FromMinutes(10)); |
35 static const size_t kPLTCount(100); | 35 static const size_t kPLTCount(100); |
36 | 36 |
37 #define PLT_HISTOGRAM(name, sample) \ | 37 #define PLT_HISTOGRAM(name, sample) \ |
38 UMA_HISTOGRAM_CUSTOM_TIMES(name, sample, kPLTMin, kPLTMax, kPLTCount); | 38 UMA_HISTOGRAM_CUSTOM_TIMES(name, sample, kPLTMin, kPLTMax, kPLTCount); |
39 | 39 |
40 // Returns the scheme type of the given URL if its type is one for which we | 40 // Returns the scheme type of the given URL if its type is one for which we |
41 // dump page load histograms. Otherwise returns NULL. | 41 // dump page load histograms. Otherwise returns NULL. |
42 static URLPattern::SchemeMasks GetSupportedSchemeType(const GURL& url) { | 42 static URLPattern::SchemeMasks GetSupportedSchemeType(const GURL& url) { |
43 if (url.SchemeIs("http")) | 43 if (url.SchemeIs("http")) |
44 return URLPattern::SCHEME_HTTP; | 44 return URLPattern::SCHEME_HTTP; |
45 else if (url.SchemeIs("https")) | 45 else if (url.SchemeIs("https")) |
46 return URLPattern::SCHEME_HTTPS; | 46 return URLPattern::SCHEME_HTTPS; |
47 return static_cast<URLPattern::SchemeMasks>(0); | 47 return static_cast<URLPattern::SchemeMasks>(0); |
48 } | 48 } |
49 | 49 |
50 static void DumpWebTiming(const Time& navigation_start, | 50 static void DumpWebTiming(const Time& navigation_start, |
51 const Time& load_event_start, | 51 const Time& load_event_start, |
52 const Time& load_event_end, | 52 const Time& load_event_end, |
53 content::NavigationState* navigation_state) { | 53 DocumentState* document_state) { |
54 if (navigation_start.is_null() || | 54 if (navigation_start.is_null() || |
55 load_event_start.is_null() || | 55 load_event_start.is_null() || |
56 load_event_end.is_null()) | 56 load_event_end.is_null()) |
57 return; | 57 return; |
58 | 58 |
59 if (navigation_state->web_timing_histograms_recorded()) | 59 if (document_state->web_timing_histograms_recorded()) |
60 return; | 60 return; |
61 navigation_state->set_web_timing_histograms_recorded(true); | 61 document_state->set_web_timing_histograms_recorded(true); |
62 | 62 |
63 // TODO(tonyg): There are many new details we can record, add them after the | 63 // TODO(tonyg): There are many new details we can record, add them after the |
64 // basic metrics are evaluated. | 64 // basic metrics are evaluated. |
65 // TODO(simonjam): There is no way to distinguish between abandonment and | 65 // TODO(simonjam): There is no way to distinguish between abandonment and |
66 // intentional Javascript navigation before the load event fires. | 66 // intentional Javascript navigation before the load event fires. |
67 PLT_HISTOGRAM("PLT.NavStartToLoadStart", load_event_start - navigation_start); | 67 PLT_HISTOGRAM("PLT.NavStartToLoadStart", load_event_start - navigation_start); |
68 PLT_HISTOGRAM("PLT.NavStartToLoadEnd", load_event_end - navigation_start); | 68 PLT_HISTOGRAM("PLT.NavStartToLoadEnd", load_event_end - navigation_start); |
69 } | 69 } |
70 | 70 |
71 enum MissingStartType { | 71 enum MissingStartType { |
(...skipping 29 matching lines...) Expand all Loading... |
101 // Only dump for supported schemes. | 101 // Only dump for supported schemes. |
102 URLPattern::SchemeMasks scheme_type = | 102 URLPattern::SchemeMasks scheme_type = |
103 GetSupportedSchemeType(frame->document().url()); | 103 GetSupportedSchemeType(frame->document().url()); |
104 if (scheme_type == 0) | 104 if (scheme_type == 0) |
105 return; | 105 return; |
106 | 106 |
107 // Ignore multipart requests. | 107 // Ignore multipart requests. |
108 if (frame->dataSource()->response().isMultipartPayload()) | 108 if (frame->dataSource()->response().isMultipartPayload()) |
109 return; | 109 return; |
110 | 110 |
111 NavigationState* navigation_state = | 111 DocumentState* document_state = |
112 NavigationState::FromDataSource(frame->dataSource()); | 112 DocumentState::FromDataSource(frame->dataSource()); |
113 | 113 |
114 // Times based on the Web Timing metrics. | 114 // Times based on the Web Timing metrics. |
115 // http://www.w3.org/TR/navigation-timing/ | 115 // http://www.w3.org/TR/navigation-timing/ |
116 // TODO(tonyg, jar): We are in the process of vetting these metrics against | 116 // TODO(tonyg, jar): We are in the process of vetting these metrics against |
117 // the existing ones. Once we understand any differences, we will standardize | 117 // the existing ones. Once we understand any differences, we will standardize |
118 // on a single set of metrics. | 118 // on a single set of metrics. |
119 const WebPerformance& performance = frame->performance(); | 119 const WebPerformance& performance = frame->performance(); |
120 Time navigation_start = Time::FromDoubleT(performance.navigationStart()); | 120 Time navigation_start = Time::FromDoubleT(performance.navigationStart()); |
121 Time load_event_start = Time::FromDoubleT(performance.loadEventStart()); | 121 Time load_event_start = Time::FromDoubleT(performance.loadEventStart()); |
122 Time load_event_end = Time::FromDoubleT(performance.loadEventEnd()); | 122 Time load_event_end = Time::FromDoubleT(performance.loadEventEnd()); |
123 DumpWebTiming(navigation_start, load_event_start, load_event_end, | 123 DumpWebTiming(navigation_start, load_event_start, load_event_end, |
124 navigation_state); | 124 document_state); |
125 | 125 |
126 // If we've already dumped, do nothing. | 126 // If we've already dumped, do nothing. |
127 // This simple bool works because we only dump for the main frame. | 127 // This simple bool works because we only dump for the main frame. |
128 if (navigation_state->load_histograms_recorded()) | 128 if (document_state->load_histograms_recorded()) |
129 return; | 129 return; |
130 | 130 |
131 // Collect measurement times. | 131 // Collect measurement times. |
132 Time start = navigation_state->start_load_time(); | 132 Time start = document_state->start_load_time(); |
133 Time commit = navigation_state->commit_load_time(); | 133 Time commit = document_state->commit_load_time(); |
134 | 134 |
135 // TODO(tonyg, jar): Start can be missing after an in-document navigation and | 135 // TODO(tonyg, jar): Start can be missing after an in-document navigation and |
136 // possibly other cases like a very premature abandonment of the page. | 136 // possibly other cases like a very premature abandonment of the page. |
137 // The PLT.MissingStart histogram should help us troubleshoot and then we can | 137 // The PLT.MissingStart histogram should help us troubleshoot and then we can |
138 // remove this. | 138 // remove this. |
139 int missing_start_type = 0; | 139 int missing_start_type = 0; |
140 missing_start_type |= start.is_null() ? START_MISSING : 0; | 140 missing_start_type |= start.is_null() ? START_MISSING : 0; |
141 missing_start_type |= commit.is_null() ? COMMIT_MISSING : 0; | 141 missing_start_type |= commit.is_null() ? COMMIT_MISSING : 0; |
142 missing_start_type |= navigation_start.is_null() ? NAV_START_MISSING : 0; | 142 missing_start_type |= navigation_start.is_null() ? NAV_START_MISSING : 0; |
143 UMA_HISTOGRAM_ENUMERATION("PLT.MissingStart", missing_start_type, | 143 UMA_HISTOGRAM_ENUMERATION("PLT.MissingStart", missing_start_type, |
144 MISSING_START_TYPE_MAX); | 144 MISSING_START_TYPE_MAX); |
145 if (missing_start_type) | 145 if (missing_start_type) |
146 return; | 146 return; |
147 | 147 |
148 // We properly handle null values for the next 3 variables. | 148 // We properly handle null values for the next 3 variables. |
149 Time request = navigation_state->request_time(); | 149 Time request = document_state->request_time(); |
150 Time first_paint = navigation_state->first_paint_time(); | 150 Time first_paint = document_state->first_paint_time(); |
151 Time first_paint_after_load = navigation_state->first_paint_after_load_time(); | 151 Time first_paint_after_load = document_state->first_paint_after_load_time(); |
152 Time finish_doc = navigation_state->finish_document_load_time(); | 152 Time finish_doc = document_state->finish_document_load_time(); |
153 Time finish_all_loads = navigation_state->finish_load_time(); | 153 Time finish_all_loads = document_state->finish_load_time(); |
154 | 154 |
155 // TODO(tonyg, jar): We suspect a bug in abandonment counting, this temporary | 155 // TODO(tonyg, jar): We suspect a bug in abandonment counting, this temporary |
156 // histogram should help us to troubleshoot. | 156 // histogram should help us to troubleshoot. |
157 int abandon_type = 0; | 157 int abandon_type = 0; |
158 abandon_type |= finish_doc.is_null() ? FINISH_DOC_MISSING : 0; | 158 abandon_type |= finish_doc.is_null() ? FINISH_DOC_MISSING : 0; |
159 abandon_type |= finish_all_loads.is_null() ? FINISH_ALL_LOADS_MISSING : 0; | 159 abandon_type |= finish_all_loads.is_null() ? FINISH_ALL_LOADS_MISSING : 0; |
160 abandon_type |= load_event_start.is_null() ? LOAD_EVENT_START_MISSING : 0; | 160 abandon_type |= load_event_start.is_null() ? LOAD_EVENT_START_MISSING : 0; |
161 abandon_type |= load_event_end.is_null() ? LOAD_EVENT_END_MISSING : 0; | 161 abandon_type |= load_event_end.is_null() ? LOAD_EVENT_END_MISSING : 0; |
162 UMA_HISTOGRAM_ENUMERATION("PLT.AbandonType", abandon_type, ABANDON_TYPE_MAX); | 162 UMA_HISTOGRAM_ENUMERATION("PLT.AbandonType", abandon_type, ABANDON_TYPE_MAX); |
163 | 163 |
164 // Handle case where user hits "stop" or "back" before loading completely. | 164 // Handle case where user hits "stop" or "back" before loading completely. |
165 bool abandoned_page = finish_doc.is_null(); | 165 bool abandoned_page = finish_doc.is_null(); |
166 if (abandoned_page) { | 166 if (abandoned_page) { |
167 finish_doc = Time::Now(); | 167 finish_doc = Time::Now(); |
168 navigation_state->set_finish_document_load_time(finish_doc); | 168 document_state->set_finish_document_load_time(finish_doc); |
169 } | 169 } |
170 | 170 |
171 // TODO(jar): We should really discriminate the definition of "abandon" more | 171 // TODO(jar): We should really discriminate the definition of "abandon" more |
172 // finely. We should have: | 172 // finely. We should have: |
173 // abandon_before_document_loaded | 173 // abandon_before_document_loaded |
174 // abandon_before_onload_fired | 174 // abandon_before_onload_fired |
175 | 175 |
176 if (finish_all_loads.is_null()) { | 176 if (finish_all_loads.is_null()) { |
177 finish_all_loads = Time::Now(); | 177 finish_all_loads = Time::Now(); |
178 navigation_state->set_finish_load_time(finish_all_loads); | 178 document_state->set_finish_load_time(finish_all_loads); |
179 } else { | 179 } else { |
180 DCHECK(!abandoned_page); // How can the doc have finished but not the page? | 180 DCHECK(!abandoned_page); // How can the doc have finished but not the page? |
181 if (abandoned_page) | 181 if (abandoned_page) |
182 return; // Don't try to record a stat which is broken. | 182 return; // Don't try to record a stat which is broken. |
183 } | 183 } |
184 | 184 |
185 navigation_state->set_load_histograms_recorded(true); | 185 document_state->set_load_histograms_recorded(true); |
186 | 186 |
187 // Note: Client side redirects will have no request time. | 187 // Note: Client side redirects will have no request time. |
188 Time begin = request.is_null() ? start : request; | 188 Time begin = request.is_null() ? start : request; |
189 TimeDelta begin_to_finish_doc = finish_doc - begin; | 189 TimeDelta begin_to_finish_doc = finish_doc - begin; |
190 TimeDelta begin_to_finish_all_loads = finish_all_loads - begin; | 190 TimeDelta begin_to_finish_all_loads = finish_all_loads - begin; |
191 TimeDelta start_to_finish_all_loads = finish_all_loads - start; | 191 TimeDelta start_to_finish_all_loads = finish_all_loads - start; |
192 TimeDelta start_to_commit = commit - start; | 192 TimeDelta start_to_commit = commit - start; |
193 | 193 |
194 NavigationState::LoadType load_type = navigation_state->load_type(); | 194 DocumentState::LoadType load_type = document_state->load_type(); |
195 | 195 |
196 // The above code sanitized all values of times, in preparation for creating | 196 // The above code sanitized all values of times, in preparation for creating |
197 // actual histograms. The remainder of this code could be run at destructor | 197 // actual histograms. The remainder of this code could be run at destructor |
198 // time for the navigation_state, since all data is intact. | 198 // time for the document_state, since all data is intact. |
199 | 199 |
200 // Aggregate PLT data across all link types. | 200 // Aggregate PLT data across all link types. |
201 UMA_HISTOGRAM_ENUMERATION("PLT.Abandoned", abandoned_page ? 1 : 0, 2); | 201 UMA_HISTOGRAM_ENUMERATION("PLT.Abandoned", abandoned_page ? 1 : 0, 2); |
202 UMA_HISTOGRAM_ENUMERATION("PLT.LoadType", load_type, | 202 UMA_HISTOGRAM_ENUMERATION("PLT.LoadType", load_type, |
203 NavigationState::kLoadTypeMax); | 203 DocumentState::kLoadTypeMax); |
204 PLT_HISTOGRAM("PLT.StartToCommit", start_to_commit); | 204 PLT_HISTOGRAM("PLT.StartToCommit", start_to_commit); |
205 PLT_HISTOGRAM("PLT.CommitToFinishDoc", finish_doc - commit); | 205 PLT_HISTOGRAM("PLT.CommitToFinishDoc", finish_doc - commit); |
206 PLT_HISTOGRAM("PLT.FinishDocToFinish", finish_all_loads - finish_doc); | 206 PLT_HISTOGRAM("PLT.FinishDocToFinish", finish_all_loads - finish_doc); |
207 PLT_HISTOGRAM("PLT.BeginToCommit", commit - begin); | 207 PLT_HISTOGRAM("PLT.BeginToCommit", commit - begin); |
208 PLT_HISTOGRAM("PLT.StartToFinish", start_to_finish_all_loads); | 208 PLT_HISTOGRAM("PLT.StartToFinish", start_to_finish_all_loads); |
209 if (!request.is_null()) { | 209 if (!request.is_null()) { |
210 PLT_HISTOGRAM("PLT.RequestToStart", start - request); | 210 PLT_HISTOGRAM("PLT.RequestToStart", start - request); |
211 PLT_HISTOGRAM("PLT.RequestToFinish", finish_all_loads - request); | 211 PLT_HISTOGRAM("PLT.RequestToFinish", finish_all_loads - request); |
212 } | 212 } |
213 PLT_HISTOGRAM("PLT.CommitToFinish", finish_all_loads - commit); | 213 PLT_HISTOGRAM("PLT.CommitToFinish", finish_all_loads - commit); |
(...skipping 12 matching lines...) Expand all Loading... |
226 first_paint_after_load - commit); | 226 first_paint_after_load - commit); |
227 DCHECK(finish_all_loads <= first_paint_after_load); | 227 DCHECK(finish_all_loads <= first_paint_after_load); |
228 PLT_HISTOGRAM("PLT.FinishToFirstPaintAfterLoad", | 228 PLT_HISTOGRAM("PLT.FinishToFirstPaintAfterLoad", |
229 first_paint_after_load - finish_all_loads); | 229 first_paint_after_load - finish_all_loads); |
230 } | 230 } |
231 PLT_HISTOGRAM("PLT.BeginToFinishDoc", begin_to_finish_doc); | 231 PLT_HISTOGRAM("PLT.BeginToFinishDoc", begin_to_finish_doc); |
232 PLT_HISTOGRAM("PLT.BeginToFinish", begin_to_finish_all_loads); | 232 PLT_HISTOGRAM("PLT.BeginToFinish", begin_to_finish_all_loads); |
233 | 233 |
234 // Load type related histograms. | 234 // Load type related histograms. |
235 switch (load_type) { | 235 switch (load_type) { |
236 case NavigationState::UNDEFINED_LOAD: | 236 case DocumentState::UNDEFINED_LOAD: |
237 PLT_HISTOGRAM("PLT.BeginToFinishDoc_UndefLoad", begin_to_finish_doc); | 237 PLT_HISTOGRAM("PLT.BeginToFinishDoc_UndefLoad", begin_to_finish_doc); |
238 PLT_HISTOGRAM("PLT.BeginToFinish_UndefLoad", begin_to_finish_all_loads); | 238 PLT_HISTOGRAM("PLT.BeginToFinish_UndefLoad", begin_to_finish_all_loads); |
239 break; | 239 break; |
240 case NavigationState::RELOAD: | 240 case DocumentState::RELOAD: |
241 PLT_HISTOGRAM("PLT.BeginToFinishDoc_Reload", begin_to_finish_doc); | 241 PLT_HISTOGRAM("PLT.BeginToFinishDoc_Reload", begin_to_finish_doc); |
242 PLT_HISTOGRAM("PLT.BeginToFinish_Reload", begin_to_finish_all_loads); | 242 PLT_HISTOGRAM("PLT.BeginToFinish_Reload", begin_to_finish_all_loads); |
243 break; | 243 break; |
244 case NavigationState::HISTORY_LOAD: | 244 case DocumentState::HISTORY_LOAD: |
245 PLT_HISTOGRAM("PLT.BeginToFinishDoc_HistoryLoad", begin_to_finish_doc); | 245 PLT_HISTOGRAM("PLT.BeginToFinishDoc_HistoryLoad", begin_to_finish_doc); |
246 PLT_HISTOGRAM("PLT.BeginToFinish_HistoryLoad", begin_to_finish_all_loads); | 246 PLT_HISTOGRAM("PLT.BeginToFinish_HistoryLoad", begin_to_finish_all_loads); |
247 break; | 247 break; |
248 case NavigationState::NORMAL_LOAD: | 248 case DocumentState::NORMAL_LOAD: |
249 PLT_HISTOGRAM("PLT.BeginToFinishDoc_NormalLoad", begin_to_finish_doc); | 249 PLT_HISTOGRAM("PLT.BeginToFinishDoc_NormalLoad", begin_to_finish_doc); |
250 PLT_HISTOGRAM("PLT.BeginToFinish_NormalLoad", begin_to_finish_all_loads); | 250 PLT_HISTOGRAM("PLT.BeginToFinish_NormalLoad", begin_to_finish_all_loads); |
251 break; | 251 break; |
252 case NavigationState::LINK_LOAD_NORMAL: | 252 case DocumentState::LINK_LOAD_NORMAL: |
253 PLT_HISTOGRAM("PLT.BeginToFinishDoc_LinkLoadNormal", | 253 PLT_HISTOGRAM("PLT.BeginToFinishDoc_LinkLoadNormal", |
254 begin_to_finish_doc); | 254 begin_to_finish_doc); |
255 PLT_HISTOGRAM("PLT.BeginToFinish_LinkLoadNormal", | 255 PLT_HISTOGRAM("PLT.BeginToFinish_LinkLoadNormal", |
256 begin_to_finish_all_loads); | 256 begin_to_finish_all_loads); |
257 break; | 257 break; |
258 case NavigationState::LINK_LOAD_RELOAD: | 258 case DocumentState::LINK_LOAD_RELOAD: |
259 PLT_HISTOGRAM("PLT.BeginToFinishDoc_LinkLoadReload", | 259 PLT_HISTOGRAM("PLT.BeginToFinishDoc_LinkLoadReload", |
260 begin_to_finish_doc); | 260 begin_to_finish_doc); |
261 PLT_HISTOGRAM("PLT.BeginToFinish_LinkLoadReload", | 261 PLT_HISTOGRAM("PLT.BeginToFinish_LinkLoadReload", |
262 begin_to_finish_all_loads); | 262 begin_to_finish_all_loads); |
263 break; | 263 break; |
264 case NavigationState::LINK_LOAD_CACHE_STALE_OK: | 264 case DocumentState::LINK_LOAD_CACHE_STALE_OK: |
265 PLT_HISTOGRAM("PLT.BeginToFinishDoc_LinkLoadStaleOk", | 265 PLT_HISTOGRAM("PLT.BeginToFinishDoc_LinkLoadStaleOk", |
266 begin_to_finish_doc); | 266 begin_to_finish_doc); |
267 PLT_HISTOGRAM("PLT.BeginToFinish_LinkLoadStaleOk", | 267 PLT_HISTOGRAM("PLT.BeginToFinish_LinkLoadStaleOk", |
268 begin_to_finish_all_loads); | 268 begin_to_finish_all_loads); |
269 break; | 269 break; |
270 case NavigationState::LINK_LOAD_CACHE_ONLY: | 270 case DocumentState::LINK_LOAD_CACHE_ONLY: |
271 PLT_HISTOGRAM("PLT.BeginToFinishDoc_LinkLoadCacheOnly", | 271 PLT_HISTOGRAM("PLT.BeginToFinishDoc_LinkLoadCacheOnly", |
272 begin_to_finish_doc); | 272 begin_to_finish_doc); |
273 PLT_HISTOGRAM("PLT.BeginToFinish_LinkLoadCacheOnly", | 273 PLT_HISTOGRAM("PLT.BeginToFinish_LinkLoadCacheOnly", |
274 begin_to_finish_all_loads); | 274 begin_to_finish_all_loads); |
275 break; | 275 break; |
276 default: | 276 default: |
277 break; | 277 break; |
278 } | 278 } |
279 | 279 |
280 // Histograms to determine if DNS prefetching has an impact on PLT. | 280 // Histograms to determine if DNS prefetching has an impact on PLT. |
281 static const bool use_dns_histogram = | 281 static const bool use_dns_histogram = |
282 base::FieldTrialList::TrialExists("DnsImpact"); | 282 base::FieldTrialList::TrialExists("DnsImpact"); |
283 if (use_dns_histogram) { | 283 if (use_dns_histogram) { |
284 UMA_HISTOGRAM_ENUMERATION( | 284 UMA_HISTOGRAM_ENUMERATION( |
285 base::FieldTrial::MakeName("PLT.Abandoned", "DnsImpact"), | 285 base::FieldTrial::MakeName("PLT.Abandoned", "DnsImpact"), |
286 abandoned_page ? 1 : 0, 2); | 286 abandoned_page ? 1 : 0, 2); |
287 UMA_HISTOGRAM_ENUMERATION( | 287 UMA_HISTOGRAM_ENUMERATION( |
288 base::FieldTrial::MakeName("PLT.LoadType", "DnsImpact"), | 288 base::FieldTrial::MakeName("PLT.LoadType", "DnsImpact"), |
289 load_type, NavigationState::kLoadTypeMax); | 289 load_type, DocumentState::kLoadTypeMax); |
290 switch (load_type) { | 290 switch (load_type) { |
291 case NavigationState::NORMAL_LOAD: | 291 case DocumentState::NORMAL_LOAD: |
292 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 292 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
293 "PLT.BeginToFinish_NormalLoad", "DnsImpact"), | 293 "PLT.BeginToFinish_NormalLoad", "DnsImpact"), |
294 begin_to_finish_all_loads); | 294 begin_to_finish_all_loads); |
295 break; | 295 break; |
296 case NavigationState::LINK_LOAD_NORMAL: | 296 case DocumentState::LINK_LOAD_NORMAL: |
297 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 297 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
298 "PLT.BeginToFinish_LinkLoadNormal", "DnsImpact"), | 298 "PLT.BeginToFinish_LinkLoadNormal", "DnsImpact"), |
299 begin_to_finish_all_loads); | 299 begin_to_finish_all_loads); |
300 break; | 300 break; |
301 case NavigationState::LINK_LOAD_RELOAD: | 301 case DocumentState::LINK_LOAD_RELOAD: |
302 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 302 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
303 "PLT.BeginToFinish_LinkLoadReload", "DnsImpact"), | 303 "PLT.BeginToFinish_LinkLoadReload", "DnsImpact"), |
304 begin_to_finish_all_loads); | 304 begin_to_finish_all_loads); |
305 break; | 305 break; |
306 case NavigationState::LINK_LOAD_CACHE_STALE_OK: | 306 case DocumentState::LINK_LOAD_CACHE_STALE_OK: |
307 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 307 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
308 "PLT.BeginToFinish_LinkLoadStaleOk", "DnsImpact"), | 308 "PLT.BeginToFinish_LinkLoadStaleOk", "DnsImpact"), |
309 begin_to_finish_all_loads); | 309 begin_to_finish_all_loads); |
310 break; | 310 break; |
311 default: | 311 default: |
312 break; | 312 break; |
313 } | 313 } |
314 } | 314 } |
315 | 315 |
316 // Histograms to determine if content prefetching has an impact on PLT. | 316 // Histograms to determine if content prefetching has an impact on PLT. |
317 // TODO(gavinp): Right now the prerendering and the prefetching field trials | 317 // TODO(gavinp): Right now the prerendering and the prefetching field trials |
318 // are mixed together. If we continue to launch prerender with | 318 // are mixed together. If we continue to launch prerender with |
319 // link rel=prerender, then we should separate them. | 319 // link rel=prerender, then we should separate them. |
320 static const bool prefetching_fieldtrial = | 320 static const bool prefetching_fieldtrial = |
321 base::FieldTrialList::TrialExists("Prefetch"); | 321 base::FieldTrialList::TrialExists("Prefetch"); |
322 if (prefetching_fieldtrial) { | 322 if (prefetching_fieldtrial) { |
323 if (navigation_state->was_prefetcher()) { | 323 if (document_state->was_prefetcher()) { |
324 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 324 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
325 "PLT.BeginToFinishDoc_ContentPrefetcher", "Prefetch"), | 325 "PLT.BeginToFinishDoc_ContentPrefetcher", "Prefetch"), |
326 begin_to_finish_doc); | 326 begin_to_finish_doc); |
327 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 327 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
328 "PLT.BeginToFinish_ContentPrefetcher", "Prefetch"), | 328 "PLT.BeginToFinish_ContentPrefetcher", "Prefetch"), |
329 begin_to_finish_all_loads); | 329 begin_to_finish_all_loads); |
330 } | 330 } |
331 if (navigation_state->was_referred_by_prefetcher()) { | 331 if (document_state->was_referred_by_prefetcher()) { |
332 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 332 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
333 "PLT.BeginToFinishDoc_ContentPrefetcherReferrer", "Prefetch"), | 333 "PLT.BeginToFinishDoc_ContentPrefetcherReferrer", "Prefetch"), |
334 begin_to_finish_doc); | 334 begin_to_finish_doc); |
335 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 335 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
336 "PLT.BeginToFinish_ContentPrefetcherReferrer", "Prefetch"), | 336 "PLT.BeginToFinish_ContentPrefetcherReferrer", "Prefetch"), |
337 begin_to_finish_all_loads); | 337 begin_to_finish_all_loads); |
338 } | 338 } |
339 UMA_HISTOGRAM_ENUMERATION(base::FieldTrial::MakeName( | 339 UMA_HISTOGRAM_ENUMERATION(base::FieldTrial::MakeName( |
340 "PLT.Abandoned", "Prefetch"), | 340 "PLT.Abandoned", "Prefetch"), |
341 abandoned_page ? 1 : 0, 2); | 341 abandoned_page ? 1 : 0, 2); |
342 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 342 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
343 "PLT.BeginToFinishDoc", "Prefetch"), | 343 "PLT.BeginToFinishDoc", "Prefetch"), |
344 begin_to_finish_doc); | 344 begin_to_finish_doc); |
345 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 345 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
346 "PLT.BeginToFinish", "Prefetch"), | 346 "PLT.BeginToFinish", "Prefetch"), |
347 begin_to_finish_all_loads); | 347 begin_to_finish_all_loads); |
348 } | 348 } |
349 | 349 |
350 // Histograms to determine if backup connection jobs have an impact on PLT. | 350 // Histograms to determine if backup connection jobs have an impact on PLT. |
351 static const bool connect_backup_jobs_fieldtrial = | 351 static const bool connect_backup_jobs_fieldtrial = |
352 base::FieldTrialList::TrialExists("ConnnectBackupJobs"); | 352 base::FieldTrialList::TrialExists("ConnnectBackupJobs"); |
353 if (connect_backup_jobs_fieldtrial) { | 353 if (connect_backup_jobs_fieldtrial) { |
354 UMA_HISTOGRAM_ENUMERATION( | 354 UMA_HISTOGRAM_ENUMERATION( |
355 base::FieldTrial::MakeName("PLT.Abandoned", "ConnnectBackupJobs"), | 355 base::FieldTrial::MakeName("PLT.Abandoned", "ConnnectBackupJobs"), |
356 abandoned_page ? 1 : 0, 2); | 356 abandoned_page ? 1 : 0, 2); |
357 UMA_HISTOGRAM_ENUMERATION( | 357 UMA_HISTOGRAM_ENUMERATION( |
358 base::FieldTrial::MakeName("PLT.LoadType", "ConnnectBackupJobs"), | 358 base::FieldTrial::MakeName("PLT.LoadType", "ConnnectBackupJobs"), |
359 load_type, NavigationState::kLoadTypeMax); | 359 load_type, DocumentState::kLoadTypeMax); |
360 switch (load_type) { | 360 switch (load_type) { |
361 case NavigationState::NORMAL_LOAD: | 361 case DocumentState::NORMAL_LOAD: |
362 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 362 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
363 "PLT.BeginToFinish_NormalLoad", "ConnnectBackupJobs"), | 363 "PLT.BeginToFinish_NormalLoad", "ConnnectBackupJobs"), |
364 begin_to_finish_all_loads); | 364 begin_to_finish_all_loads); |
365 break; | 365 break; |
366 case NavigationState::LINK_LOAD_NORMAL: | 366 case DocumentState::LINK_LOAD_NORMAL: |
367 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 367 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
368 "PLT.BeginToFinish_LinkLoadNormal", "ConnnectBackupJobs"), | 368 "PLT.BeginToFinish_LinkLoadNormal", "ConnnectBackupJobs"), |
369 begin_to_finish_all_loads); | 369 begin_to_finish_all_loads); |
370 break; | 370 break; |
371 case NavigationState::LINK_LOAD_RELOAD: | 371 case DocumentState::LINK_LOAD_RELOAD: |
372 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 372 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
373 "PLT.BeginToFinish_LinkLoadReload", "ConnnectBackupJobs"), | 373 "PLT.BeginToFinish_LinkLoadReload", "ConnnectBackupJobs"), |
374 begin_to_finish_all_loads); | 374 begin_to_finish_all_loads); |
375 break; | 375 break; |
376 case NavigationState::LINK_LOAD_CACHE_STALE_OK: | 376 case DocumentState::LINK_LOAD_CACHE_STALE_OK: |
377 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 377 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
378 "PLT.BeginToFinish_LinkLoadStaleOk", "ConnnectBackupJobs"), | 378 "PLT.BeginToFinish_LinkLoadStaleOk", "ConnnectBackupJobs"), |
379 begin_to_finish_all_loads); | 379 begin_to_finish_all_loads); |
380 break; | 380 break; |
381 default: | 381 default: |
382 break; | 382 break; |
383 } | 383 } |
384 } | 384 } |
385 | 385 |
386 // Histograms to determine if the number of connections has an | 386 // Histograms to determine if the number of connections has an |
387 // impact on PLT. | 387 // impact on PLT. |
388 // TODO(jar): Consider removing the per-link-type versions. We | 388 // TODO(jar): Consider removing the per-link-type versions. We |
389 // really only need LINK_LOAD_NORMAL and NORMAL_LOAD. | 389 // really only need LINK_LOAD_NORMAL and NORMAL_LOAD. |
390 static const bool use_connection_impact_histogram = | 390 static const bool use_connection_impact_histogram = |
391 base::FieldTrialList::TrialExists("ConnCountImpact"); | 391 base::FieldTrialList::TrialExists("ConnCountImpact"); |
392 if (use_connection_impact_histogram) { | 392 if (use_connection_impact_histogram) { |
393 UMA_HISTOGRAM_ENUMERATION( | 393 UMA_HISTOGRAM_ENUMERATION( |
394 base::FieldTrial::MakeName("PLT.Abandoned", "ConnCountImpact"), | 394 base::FieldTrial::MakeName("PLT.Abandoned", "ConnCountImpact"), |
395 abandoned_page ? 1 : 0, 2); | 395 abandoned_page ? 1 : 0, 2); |
396 switch (load_type) { | 396 switch (load_type) { |
397 case NavigationState::NORMAL_LOAD: | 397 case DocumentState::NORMAL_LOAD: |
398 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 398 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
399 "PLT.BeginToFinish_NormalLoad", "ConnCountImpact"), | 399 "PLT.BeginToFinish_NormalLoad", "ConnCountImpact"), |
400 begin_to_finish_all_loads); | 400 begin_to_finish_all_loads); |
401 break; | 401 break; |
402 case NavigationState::LINK_LOAD_NORMAL: | 402 case DocumentState::LINK_LOAD_NORMAL: |
403 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 403 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
404 "PLT.BeginToFinish_LinkLoadNormal", "ConnCountImpact"), | 404 "PLT.BeginToFinish_LinkLoadNormal", "ConnCountImpact"), |
405 begin_to_finish_all_loads); | 405 begin_to_finish_all_loads); |
406 break; | 406 break; |
407 case NavigationState::LINK_LOAD_RELOAD: | 407 case DocumentState::LINK_LOAD_RELOAD: |
408 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 408 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
409 "PLT.BeginToFinish_LinkLoadReload", "ConnCountImpact"), | 409 "PLT.BeginToFinish_LinkLoadReload", "ConnCountImpact"), |
410 begin_to_finish_all_loads); | 410 begin_to_finish_all_loads); |
411 break; | 411 break; |
412 case NavigationState::LINK_LOAD_CACHE_STALE_OK: | 412 case DocumentState::LINK_LOAD_CACHE_STALE_OK: |
413 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 413 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
414 "PLT.BeginToFinish_LinkLoadStaleOk", "ConnCountImpact"), | 414 "PLT.BeginToFinish_LinkLoadStaleOk", "ConnCountImpact"), |
415 begin_to_finish_all_loads); | 415 begin_to_finish_all_loads); |
416 break; | 416 break; |
417 default: | 417 default: |
418 break; | 418 break; |
419 } | 419 } |
420 } | 420 } |
421 | 421 |
422 // Histograms to determine effect of idle socket timeout. | 422 // Histograms to determine effect of idle socket timeout. |
423 static const bool use_idle_socket_timeout_histogram = | 423 static const bool use_idle_socket_timeout_histogram = |
424 base::FieldTrialList::TrialExists("IdleSktToImpact"); | 424 base::FieldTrialList::TrialExists("IdleSktToImpact"); |
425 if (use_idle_socket_timeout_histogram) { | 425 if (use_idle_socket_timeout_histogram) { |
426 UMA_HISTOGRAM_ENUMERATION( | 426 UMA_HISTOGRAM_ENUMERATION( |
427 base::FieldTrial::MakeName("PLT.Abandoned", "IdleSktToImpact"), | 427 base::FieldTrial::MakeName("PLT.Abandoned", "IdleSktToImpact"), |
428 abandoned_page ? 1 : 0, 2); | 428 abandoned_page ? 1 : 0, 2); |
429 switch (load_type) { | 429 switch (load_type) { |
430 case NavigationState::NORMAL_LOAD: | 430 case DocumentState::NORMAL_LOAD: |
431 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 431 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
432 "PLT.BeginToFinish_NormalLoad", "IdleSktToImpact"), | 432 "PLT.BeginToFinish_NormalLoad", "IdleSktToImpact"), |
433 begin_to_finish_all_loads); | 433 begin_to_finish_all_loads); |
434 break; | 434 break; |
435 case NavigationState::LINK_LOAD_NORMAL: | 435 case DocumentState::LINK_LOAD_NORMAL: |
436 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 436 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
437 "PLT.BeginToFinish_LinkLoadNormal", "IdleSktToImpact"), | 437 "PLT.BeginToFinish_LinkLoadNormal", "IdleSktToImpact"), |
438 begin_to_finish_all_loads); | 438 begin_to_finish_all_loads); |
439 break; | 439 break; |
440 case NavigationState::LINK_LOAD_RELOAD: | 440 case DocumentState::LINK_LOAD_RELOAD: |
441 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 441 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
442 "PLT.BeginToFinish_LinkLoadReload", "IdleSktToImpact"), | 442 "PLT.BeginToFinish_LinkLoadReload", "IdleSktToImpact"), |
443 begin_to_finish_all_loads); | 443 begin_to_finish_all_loads); |
444 break; | 444 break; |
445 case NavigationState::LINK_LOAD_CACHE_STALE_OK: | 445 case DocumentState::LINK_LOAD_CACHE_STALE_OK: |
446 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 446 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
447 "PLT.BeginToFinish_LinkLoadStaleOk", "IdleSktToImpact"), | 447 "PLT.BeginToFinish_LinkLoadStaleOk", "IdleSktToImpact"), |
448 begin_to_finish_all_loads); | 448 begin_to_finish_all_loads); |
449 break; | 449 break; |
450 default: | 450 default: |
451 break; | 451 break; |
452 } | 452 } |
453 } | 453 } |
454 | 454 |
455 // Histograms to determine effect of number of connections per proxy. | 455 // Histograms to determine effect of number of connections per proxy. |
456 static const bool use_proxy_connection_impact_histogram = | 456 static const bool use_proxy_connection_impact_histogram = |
457 base::FieldTrialList::TrialExists("ProxyConnectionImpact"); | 457 base::FieldTrialList::TrialExists("ProxyConnectionImpact"); |
458 if (use_proxy_connection_impact_histogram) { | 458 if (use_proxy_connection_impact_histogram) { |
459 UMA_HISTOGRAM_ENUMERATION( | 459 UMA_HISTOGRAM_ENUMERATION( |
460 base::FieldTrial::MakeName("PLT.Abandoned", "ProxyConnectionImpact"), | 460 base::FieldTrial::MakeName("PLT.Abandoned", "ProxyConnectionImpact"), |
461 abandoned_page ? 1 : 0, 2); | 461 abandoned_page ? 1 : 0, 2); |
462 switch (load_type) { | 462 switch (load_type) { |
463 case NavigationState::NORMAL_LOAD: | 463 case DocumentState::NORMAL_LOAD: |
464 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 464 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
465 "PLT.BeginToFinish_NormalLoad", "ProxyConnectionImpact"), | 465 "PLT.BeginToFinish_NormalLoad", "ProxyConnectionImpact"), |
466 begin_to_finish_all_loads); | 466 begin_to_finish_all_loads); |
467 break; | 467 break; |
468 case NavigationState::LINK_LOAD_NORMAL: | 468 case DocumentState::LINK_LOAD_NORMAL: |
469 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 469 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
470 "PLT.BeginToFinish_LinkLoadNormal", "ProxyConnectionImpact"), | 470 "PLT.BeginToFinish_LinkLoadNormal", "ProxyConnectionImpact"), |
471 begin_to_finish_all_loads); | 471 begin_to_finish_all_loads); |
472 break; | 472 break; |
473 case NavigationState::LINK_LOAD_RELOAD: | 473 case DocumentState::LINK_LOAD_RELOAD: |
474 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 474 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
475 "PLT.BeginToFinish_LinkLoadReload", "ProxyConnectionImpact"), | 475 "PLT.BeginToFinish_LinkLoadReload", "ProxyConnectionImpact"), |
476 begin_to_finish_all_loads); | 476 begin_to_finish_all_loads); |
477 break; | 477 break; |
478 case NavigationState::LINK_LOAD_CACHE_STALE_OK: | 478 case DocumentState::LINK_LOAD_CACHE_STALE_OK: |
479 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 479 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
480 "PLT.BeginToFinish_LinkLoadStaleOk", "ProxyConnectionImpact"), | 480 "PLT.BeginToFinish_LinkLoadStaleOk", "ProxyConnectionImpact"), |
481 begin_to_finish_all_loads); | 481 begin_to_finish_all_loads); |
482 break; | 482 break; |
483 default: | 483 default: |
484 break; | 484 break; |
485 } | 485 } |
486 } | 486 } |
487 | 487 |
488 // Histograms to determine if SDCH has an impact. | 488 // Histograms to determine if SDCH has an impact. |
489 // TODO(jar): Consider removing per-link load types and the enumeration. | 489 // TODO(jar): Consider removing per-link load types and the enumeration. |
490 static const bool use_sdch_histogram = | 490 static const bool use_sdch_histogram = |
491 base::FieldTrialList::TrialExists("GlobalSdch"); | 491 base::FieldTrialList::TrialExists("GlobalSdch"); |
492 if (use_sdch_histogram) { | 492 if (use_sdch_histogram) { |
493 UMA_HISTOGRAM_ENUMERATION( | 493 UMA_HISTOGRAM_ENUMERATION( |
494 base::FieldTrial::MakeName("PLT.LoadType", "GlobalSdch"), | 494 base::FieldTrial::MakeName("PLT.LoadType", "GlobalSdch"), |
495 load_type, NavigationState::kLoadTypeMax); | 495 load_type, DocumentState::kLoadTypeMax); |
496 switch (load_type) { | 496 switch (load_type) { |
497 case NavigationState::NORMAL_LOAD: | 497 case DocumentState::NORMAL_LOAD: |
498 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 498 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
499 "PLT.BeginToFinish_NormalLoad", "GlobalSdch"), | 499 "PLT.BeginToFinish_NormalLoad", "GlobalSdch"), |
500 begin_to_finish_all_loads); | 500 begin_to_finish_all_loads); |
501 break; | 501 break; |
502 case NavigationState::LINK_LOAD_NORMAL: | 502 case DocumentState::LINK_LOAD_NORMAL: |
503 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 503 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
504 "PLT.BeginToFinish_LinkLoadNormal", "GlobalSdch"), | 504 "PLT.BeginToFinish_LinkLoadNormal", "GlobalSdch"), |
505 begin_to_finish_all_loads); | 505 begin_to_finish_all_loads); |
506 break; | 506 break; |
507 case NavigationState::LINK_LOAD_RELOAD: | 507 case DocumentState::LINK_LOAD_RELOAD: |
508 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 508 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
509 "PLT.BeginToFinish_LinkLoadReload", "GlobalSdch"), | 509 "PLT.BeginToFinish_LinkLoadReload", "GlobalSdch"), |
510 begin_to_finish_all_loads); | 510 begin_to_finish_all_loads); |
511 break; | 511 break; |
512 case NavigationState::LINK_LOAD_CACHE_STALE_OK: | 512 case DocumentState::LINK_LOAD_CACHE_STALE_OK: |
513 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 513 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
514 "PLT.BeginToFinish_LinkLoadStaleOk", "GlobalSdch"), | 514 "PLT.BeginToFinish_LinkLoadStaleOk", "GlobalSdch"), |
515 begin_to_finish_all_loads); | 515 begin_to_finish_all_loads); |
516 break; | 516 break; |
517 case NavigationState::LINK_LOAD_CACHE_ONLY: | 517 case DocumentState::LINK_LOAD_CACHE_ONLY: |
518 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 518 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
519 "PLT.BeginToFinish_LinkLoadCacheOnly", "GlobalSdch"), | 519 "PLT.BeginToFinish_LinkLoadCacheOnly", "GlobalSdch"), |
520 begin_to_finish_all_loads); | 520 begin_to_finish_all_loads); |
521 break; | 521 break; |
522 default: | 522 default: |
523 break; | 523 break; |
524 } | 524 } |
525 } | 525 } |
526 | 526 |
527 // Histograms to determine the PLT impact of the cache's deleted list size. | 527 // Histograms to determine the PLT impact of the cache's deleted list size. |
528 static const bool use_cache_histogram = | 528 static const bool use_cache_histogram = |
529 base::FieldTrialList::TrialExists("CacheListSize"); | 529 base::FieldTrialList::TrialExists("CacheListSize"); |
530 if (use_cache_histogram) { | 530 if (use_cache_histogram) { |
531 UMA_HISTOGRAM_ENUMERATION( | 531 UMA_HISTOGRAM_ENUMERATION( |
532 base::FieldTrial::MakeName("PLT.Abandoned", "CacheListSize"), | 532 base::FieldTrial::MakeName("PLT.Abandoned", "CacheListSize"), |
533 abandoned_page ? 1 : 0, 2); | 533 abandoned_page ? 1 : 0, 2); |
534 switch (load_type) { | 534 switch (load_type) { |
535 case NavigationState::RELOAD: | 535 case DocumentState::RELOAD: |
536 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 536 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
537 "PLT.BeginToFinish_Reload", "CacheListSize"), | 537 "PLT.BeginToFinish_Reload", "CacheListSize"), |
538 begin_to_finish_all_loads); | 538 begin_to_finish_all_loads); |
539 break; | 539 break; |
540 case NavigationState::HISTORY_LOAD: | 540 case DocumentState::HISTORY_LOAD: |
541 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 541 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
542 "PLT.BeginToFinish_HistoryLoad", "CacheListSize"), | 542 "PLT.BeginToFinish_HistoryLoad", "CacheListSize"), |
543 begin_to_finish_all_loads); | 543 begin_to_finish_all_loads); |
544 break; | 544 break; |
545 case NavigationState::NORMAL_LOAD: | 545 case DocumentState::NORMAL_LOAD: |
546 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 546 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
547 "PLT.BeginToFinish_NormalLoad", "CacheListSize"), | 547 "PLT.BeginToFinish_NormalLoad", "CacheListSize"), |
548 begin_to_finish_all_loads); | 548 begin_to_finish_all_loads); |
549 break; | 549 break; |
550 case NavigationState::LINK_LOAD_NORMAL: | 550 case DocumentState::LINK_LOAD_NORMAL: |
551 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 551 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
552 "PLT.BeginToFinish_LinkLoadNormal", "CacheListSize"), | 552 "PLT.BeginToFinish_LinkLoadNormal", "CacheListSize"), |
553 begin_to_finish_all_loads); | 553 begin_to_finish_all_loads); |
554 break; | 554 break; |
555 case NavigationState::LINK_LOAD_RELOAD: | 555 case DocumentState::LINK_LOAD_RELOAD: |
556 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 556 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
557 "PLT.BeginToFinish_LinkLoadReload", "CacheListSize"), | 557 "PLT.BeginToFinish_LinkLoadReload", "CacheListSize"), |
558 begin_to_finish_all_loads); | 558 begin_to_finish_all_loads); |
559 break; | 559 break; |
560 case NavigationState::LINK_LOAD_CACHE_STALE_OK: | 560 case DocumentState::LINK_LOAD_CACHE_STALE_OK: |
561 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 561 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
562 "PLT.BeginToFinish_LinkLoadStaleOk", "CacheListSize"), | 562 "PLT.BeginToFinish_LinkLoadStaleOk", "CacheListSize"), |
563 begin_to_finish_all_loads); | 563 begin_to_finish_all_loads); |
564 break; | 564 break; |
565 case NavigationState::LINK_LOAD_CACHE_ONLY: | 565 case DocumentState::LINK_LOAD_CACHE_ONLY: |
566 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 566 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
567 "PLT.BeginToFinish_LinkLoadCacheOnly", "CacheListSize"), | 567 "PLT.BeginToFinish_LinkLoadCacheOnly", "CacheListSize"), |
568 begin_to_finish_all_loads); | 568 begin_to_finish_all_loads); |
569 break; | 569 break; |
570 default: | 570 default: |
571 break; | 571 break; |
572 } | 572 } |
573 if (NavigationState::RELOAD <= load_type && | 573 if (DocumentState::RELOAD <= load_type && |
574 NavigationState::LINK_LOAD_CACHE_ONLY >= load_type) { | 574 DocumentState::LINK_LOAD_CACHE_ONLY >= load_type) { |
575 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 575 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
576 "PLT.BeginToFinish", "CacheListSize"), | 576 "PLT.BeginToFinish", "CacheListSize"), |
577 begin_to_finish_all_loads); | 577 begin_to_finish_all_loads); |
578 } | 578 } |
579 } | 579 } |
580 | 580 |
581 // TODO(mpcomplete): remove the extension-related histograms after we collect | 581 // TODO(mpcomplete): remove the extension-related histograms after we collect |
582 // enough data. http://crbug.com/100411 | 582 // enough data. http://crbug.com/100411 |
583 chrome::ChromeContentRendererClient* client = | 583 chrome::ChromeContentRendererClient* client = |
584 static_cast<chrome::ChromeContentRendererClient*>( | 584 static_cast<chrome::ChromeContentRendererClient*>( |
585 content::GetContentClient()->renderer()); | 585 content::GetContentClient()->renderer()); |
586 | 586 |
587 const bool use_adblock_histogram = client->IsAdblockInstalled(); | 587 const bool use_adblock_histogram = client->IsAdblockInstalled(); |
588 if (use_adblock_histogram) { | 588 if (use_adblock_histogram) { |
589 UMA_HISTOGRAM_ENUMERATION( | 589 UMA_HISTOGRAM_ENUMERATION( |
590 "PLT.Abandoned_ExtensionAdblock", | 590 "PLT.Abandoned_ExtensionAdblock", |
591 abandoned_page ? 1 : 0, 2); | 591 abandoned_page ? 1 : 0, 2); |
592 switch (load_type) { | 592 switch (load_type) { |
593 case NavigationState::NORMAL_LOAD: | 593 case DocumentState::NORMAL_LOAD: |
594 PLT_HISTOGRAM( | 594 PLT_HISTOGRAM( |
595 "PLT.BeginToFinish_NormalLoad_ExtensionAdblock", | 595 "PLT.BeginToFinish_NormalLoad_ExtensionAdblock", |
596 begin_to_finish_all_loads); | 596 begin_to_finish_all_loads); |
597 break; | 597 break; |
598 case NavigationState::LINK_LOAD_NORMAL: | 598 case DocumentState::LINK_LOAD_NORMAL: |
599 PLT_HISTOGRAM( | 599 PLT_HISTOGRAM( |
600 "PLT.BeginToFinish_LinkLoadNormal_ExtensionAdblock", | 600 "PLT.BeginToFinish_LinkLoadNormal_ExtensionAdblock", |
601 begin_to_finish_all_loads); | 601 begin_to_finish_all_loads); |
602 break; | 602 break; |
603 case NavigationState::LINK_LOAD_RELOAD: | 603 case DocumentState::LINK_LOAD_RELOAD: |
604 PLT_HISTOGRAM( | 604 PLT_HISTOGRAM( |
605 "PLT.BeginToFinish_LinkLoadReload_ExtensionAdblock", | 605 "PLT.BeginToFinish_LinkLoadReload_ExtensionAdblock", |
606 begin_to_finish_all_loads); | 606 begin_to_finish_all_loads); |
607 break; | 607 break; |
608 case NavigationState::LINK_LOAD_CACHE_STALE_OK: | 608 case DocumentState::LINK_LOAD_CACHE_STALE_OK: |
609 PLT_HISTOGRAM( | 609 PLT_HISTOGRAM( |
610 "PLT.BeginToFinish_LinkLoadStaleOk_ExtensionAdblock", | 610 "PLT.BeginToFinish_LinkLoadStaleOk_ExtensionAdblock", |
611 begin_to_finish_all_loads); | 611 begin_to_finish_all_loads); |
612 break; | 612 break; |
613 default: | 613 default: |
614 break; | 614 break; |
615 } | 615 } |
616 } | 616 } |
617 | 617 |
618 const bool use_adblockplus_histogram = client->IsAdblockPlusInstalled(); | 618 const bool use_adblockplus_histogram = client->IsAdblockPlusInstalled(); |
619 if (use_adblockplus_histogram) { | 619 if (use_adblockplus_histogram) { |
620 UMA_HISTOGRAM_ENUMERATION( | 620 UMA_HISTOGRAM_ENUMERATION( |
621 "PLT.Abandoned_ExtensionAdblockPlus", | 621 "PLT.Abandoned_ExtensionAdblockPlus", |
622 abandoned_page ? 1 : 0, 2); | 622 abandoned_page ? 1 : 0, 2); |
623 switch (load_type) { | 623 switch (load_type) { |
624 case NavigationState::NORMAL_LOAD: | 624 case DocumentState::NORMAL_LOAD: |
625 PLT_HISTOGRAM( | 625 PLT_HISTOGRAM( |
626 "PLT.BeginToFinish_NormalLoad_ExtensionAdblockPlus", | 626 "PLT.BeginToFinish_NormalLoad_ExtensionAdblockPlus", |
627 begin_to_finish_all_loads); | 627 begin_to_finish_all_loads); |
628 break; | 628 break; |
629 case NavigationState::LINK_LOAD_NORMAL: | 629 case DocumentState::LINK_LOAD_NORMAL: |
630 PLT_HISTOGRAM( | 630 PLT_HISTOGRAM( |
631 "PLT.BeginToFinish_LinkLoadNormal_ExtensionAdblockPlus", | 631 "PLT.BeginToFinish_LinkLoadNormal_ExtensionAdblockPlus", |
632 begin_to_finish_all_loads); | 632 begin_to_finish_all_loads); |
633 break; | 633 break; |
634 case NavigationState::LINK_LOAD_RELOAD: | 634 case DocumentState::LINK_LOAD_RELOAD: |
635 PLT_HISTOGRAM( | 635 PLT_HISTOGRAM( |
636 "PLT.BeginToFinish_LinkLoadReload_ExtensionAdblockPlus", | 636 "PLT.BeginToFinish_LinkLoadReload_ExtensionAdblockPlus", |
637 begin_to_finish_all_loads); | 637 begin_to_finish_all_loads); |
638 break; | 638 break; |
639 case NavigationState::LINK_LOAD_CACHE_STALE_OK: | 639 case DocumentState::LINK_LOAD_CACHE_STALE_OK: |
640 PLT_HISTOGRAM( | 640 PLT_HISTOGRAM( |
641 "PLT.BeginToFinish_LinkLoadStaleOk_ExtensionAdblockPlus", | 641 "PLT.BeginToFinish_LinkLoadStaleOk_ExtensionAdblockPlus", |
642 begin_to_finish_all_loads); | 642 begin_to_finish_all_loads); |
643 break; | 643 break; |
644 default: | 644 default: |
645 break; | 645 break; |
646 } | 646 } |
647 } | 647 } |
648 | 648 |
649 const bool use_webrequest_adblock_histogram = | 649 const bool use_webrequest_adblock_histogram = |
650 client->IsAdblockWithWebRequestInstalled(); | 650 client->IsAdblockWithWebRequestInstalled(); |
651 if (use_webrequest_adblock_histogram) { | 651 if (use_webrequest_adblock_histogram) { |
652 UMA_HISTOGRAM_ENUMERATION( | 652 UMA_HISTOGRAM_ENUMERATION( |
653 "PLT.Abandoned_ExtensionWebRequestAdblock", | 653 "PLT.Abandoned_ExtensionWebRequestAdblock", |
654 abandoned_page ? 1 : 0, 2); | 654 abandoned_page ? 1 : 0, 2); |
655 switch (load_type) { | 655 switch (load_type) { |
656 case NavigationState::NORMAL_LOAD: | 656 case DocumentState::NORMAL_LOAD: |
657 PLT_HISTOGRAM( | 657 PLT_HISTOGRAM( |
658 "PLT.BeginToFinish_NormalLoad_ExtensionWebRequestAdblock", | 658 "PLT.BeginToFinish_NormalLoad_ExtensionWebRequestAdblock", |
659 begin_to_finish_all_loads); | 659 begin_to_finish_all_loads); |
660 break; | 660 break; |
661 case NavigationState::LINK_LOAD_NORMAL: | 661 case DocumentState::LINK_LOAD_NORMAL: |
662 PLT_HISTOGRAM( | 662 PLT_HISTOGRAM( |
663 "PLT.BeginToFinish_LinkLoadNormal_ExtensionWebRequestAdblock", | 663 "PLT.BeginToFinish_LinkLoadNormal_ExtensionWebRequestAdblock", |
664 begin_to_finish_all_loads); | 664 begin_to_finish_all_loads); |
665 break; | 665 break; |
666 case NavigationState::LINK_LOAD_RELOAD: | 666 case DocumentState::LINK_LOAD_RELOAD: |
667 PLT_HISTOGRAM( | 667 PLT_HISTOGRAM( |
668 "PLT.BeginToFinish_LinkLoadReload_ExtensionWebRequestAdblock", | 668 "PLT.BeginToFinish_LinkLoadReload_ExtensionWebRequestAdblock", |
669 begin_to_finish_all_loads); | 669 begin_to_finish_all_loads); |
670 break; | 670 break; |
671 case NavigationState::LINK_LOAD_CACHE_STALE_OK: | 671 case DocumentState::LINK_LOAD_CACHE_STALE_OK: |
672 PLT_HISTOGRAM( | 672 PLT_HISTOGRAM( |
673 "PLT.BeginToFinish_LinkLoadStaleOk_ExtensionWebRequestAdblock", | 673 "PLT.BeginToFinish_LinkLoadStaleOk_ExtensionWebRequestAdblock", |
674 begin_to_finish_all_loads); | 674 begin_to_finish_all_loads); |
675 break; | 675 break; |
676 default: | 676 default: |
677 break; | 677 break; |
678 } | 678 } |
679 } | 679 } |
680 | 680 |
681 const bool use_webrequest_adblockplus_histogram = | 681 const bool use_webrequest_adblockplus_histogram = |
682 client->IsAdblockPlusWithWebRequestInstalled(); | 682 client->IsAdblockPlusWithWebRequestInstalled(); |
683 if (use_webrequest_adblockplus_histogram) { | 683 if (use_webrequest_adblockplus_histogram) { |
684 UMA_HISTOGRAM_ENUMERATION( | 684 UMA_HISTOGRAM_ENUMERATION( |
685 "PLT.Abandoned_ExtensionWebRequestAdblockPlus", | 685 "PLT.Abandoned_ExtensionWebRequestAdblockPlus", |
686 abandoned_page ? 1 : 0, 2); | 686 abandoned_page ? 1 : 0, 2); |
687 switch (load_type) { | 687 switch (load_type) { |
688 case NavigationState::NORMAL_LOAD: | 688 case DocumentState::NORMAL_LOAD: |
689 PLT_HISTOGRAM( | 689 PLT_HISTOGRAM( |
690 "PLT.BeginToFinish_NormalLoad_ExtensionWebRequestAdblockPlus", | 690 "PLT.BeginToFinish_NormalLoad_ExtensionWebRequestAdblockPlus", |
691 begin_to_finish_all_loads); | 691 begin_to_finish_all_loads); |
692 break; | 692 break; |
693 case NavigationState::LINK_LOAD_NORMAL: | 693 case DocumentState::LINK_LOAD_NORMAL: |
694 PLT_HISTOGRAM( | 694 PLT_HISTOGRAM( |
695 "PLT.BeginToFinish_LinkLoadNormal_ExtensionWebRequestAdblockPlus", | 695 "PLT.BeginToFinish_LinkLoadNormal_ExtensionWebRequestAdblockPlus", |
696 begin_to_finish_all_loads); | 696 begin_to_finish_all_loads); |
697 break; | 697 break; |
698 case NavigationState::LINK_LOAD_RELOAD: | 698 case DocumentState::LINK_LOAD_RELOAD: |
699 PLT_HISTOGRAM( | 699 PLT_HISTOGRAM( |
700 "PLT.BeginToFinish_LinkLoadReload_ExtensionWebRequestAdblockPlus", | 700 "PLT.BeginToFinish_LinkLoadReload_ExtensionWebRequestAdblockPlus", |
701 begin_to_finish_all_loads); | 701 begin_to_finish_all_loads); |
702 break; | 702 break; |
703 case NavigationState::LINK_LOAD_CACHE_STALE_OK: | 703 case DocumentState::LINK_LOAD_CACHE_STALE_OK: |
704 PLT_HISTOGRAM( | 704 PLT_HISTOGRAM( |
705 "PLT.BeginToFinish_LinkLoadStaleOk_ExtensionWebRequestAdblockPlus", | 705 "PLT.BeginToFinish_LinkLoadStaleOk_ExtensionWebRequestAdblockPlus", |
706 begin_to_finish_all_loads); | 706 begin_to_finish_all_loads); |
707 break; | 707 break; |
708 default: | 708 default: |
709 break; | 709 break; |
710 } | 710 } |
711 } | 711 } |
712 | 712 |
713 const bool use_webrequest_other_histogram = | 713 const bool use_webrequest_other_histogram = |
714 client->IsOtherExtensionWithWebRequestInstalled(); | 714 client->IsOtherExtensionWithWebRequestInstalled(); |
715 if (use_webrequest_other_histogram) { | 715 if (use_webrequest_other_histogram) { |
716 UMA_HISTOGRAM_ENUMERATION( | 716 UMA_HISTOGRAM_ENUMERATION( |
717 "PLT.Abandoned_ExtensionWebRequestOther", | 717 "PLT.Abandoned_ExtensionWebRequestOther", |
718 abandoned_page ? 1 : 0, 2); | 718 abandoned_page ? 1 : 0, 2); |
719 switch (load_type) { | 719 switch (load_type) { |
720 case NavigationState::NORMAL_LOAD: | 720 case DocumentState::NORMAL_LOAD: |
721 PLT_HISTOGRAM( | 721 PLT_HISTOGRAM( |
722 "PLT.BeginToFinish_NormalLoad_ExtensionWebRequestOther", | 722 "PLT.BeginToFinish_NormalLoad_ExtensionWebRequestOther", |
723 begin_to_finish_all_loads); | 723 begin_to_finish_all_loads); |
724 break; | 724 break; |
725 case NavigationState::LINK_LOAD_NORMAL: | 725 case DocumentState::LINK_LOAD_NORMAL: |
726 PLT_HISTOGRAM( | 726 PLT_HISTOGRAM( |
727 "PLT.BeginToFinish_LinkLoadNormal_ExtensionWebRequestOther", | 727 "PLT.BeginToFinish_LinkLoadNormal_ExtensionWebRequestOther", |
728 begin_to_finish_all_loads); | 728 begin_to_finish_all_loads); |
729 break; | 729 break; |
730 case NavigationState::LINK_LOAD_RELOAD: | 730 case DocumentState::LINK_LOAD_RELOAD: |
731 PLT_HISTOGRAM( | 731 PLT_HISTOGRAM( |
732 "PLT.BeginToFinish_LinkLoadReload_ExtensionWebRequestOther", | 732 "PLT.BeginToFinish_LinkLoadReload_ExtensionWebRequestOther", |
733 begin_to_finish_all_loads); | 733 begin_to_finish_all_loads); |
734 break; | 734 break; |
735 case NavigationState::LINK_LOAD_CACHE_STALE_OK: | 735 case DocumentState::LINK_LOAD_CACHE_STALE_OK: |
736 PLT_HISTOGRAM( | 736 PLT_HISTOGRAM( |
737 "PLT.BeginToFinish_LinkLoadStaleOk_ExtensionWebRequestOther", | 737 "PLT.BeginToFinish_LinkLoadStaleOk_ExtensionWebRequestOther", |
738 begin_to_finish_all_loads); | 738 begin_to_finish_all_loads); |
739 break; | 739 break; |
740 default: | 740 default: |
741 break; | 741 break; |
742 } | 742 } |
743 } | 743 } |
744 | 744 |
745 // For the SPDY field trials, we need to verify that the page loaded was | 745 // For the SPDY field trials, we need to verify that the page loaded was |
746 // the type we requested: | 746 // the type we requested: |
747 // if we asked for a SPDY request, we got a SPDY request | 747 // if we asked for a SPDY request, we got a SPDY request |
748 // if we asked for a HTTP request, we got a HTTP request | 748 // if we asked for a HTTP request, we got a HTTP request |
749 // Due to spdy version mismatches, it is possible that we ask for SPDY | 749 // Due to spdy version mismatches, it is possible that we ask for SPDY |
750 // but didn't get SPDY. | 750 // but didn't get SPDY. |
751 static const bool use_spdy_histogram = | 751 static const bool use_spdy_histogram = |
752 base::FieldTrialList::TrialExists("SpdyImpact"); | 752 base::FieldTrialList::TrialExists("SpdyImpact"); |
753 if (use_spdy_histogram) { | 753 if (use_spdy_histogram) { |
754 // We take extra effort to only compute these once. | 754 // We take extra effort to only compute these once. |
755 static bool in_spdy_trial = base::FieldTrialList::Find( | 755 static bool in_spdy_trial = base::FieldTrialList::Find( |
756 "SpdyImpact")->group_name() == "npn_with_spdy"; | 756 "SpdyImpact")->group_name() == "npn_with_spdy"; |
757 static bool in_http_trial = base::FieldTrialList::Find( | 757 static bool in_http_trial = base::FieldTrialList::Find( |
758 "SpdyImpact")->group_name() == "npn_with_http"; | 758 "SpdyImpact")->group_name() == "npn_with_http"; |
759 | 759 |
760 bool spdy_trial_success = navigation_state->was_fetched_via_spdy() ? | 760 bool spdy_trial_success = document_state->was_fetched_via_spdy() ? |
761 in_spdy_trial : in_http_trial; | 761 in_spdy_trial : in_http_trial; |
762 if (spdy_trial_success) { | 762 if (spdy_trial_success) { |
763 // Histograms to determine if SPDY has an impact for https traffic. | 763 // Histograms to determine if SPDY has an impact for https traffic. |
764 // TODO(mbelshe): After we've seen the difference between BeginToFinish | 764 // TODO(mbelshe): After we've seen the difference between BeginToFinish |
765 // and StartToFinish, consider removing one or the other. | 765 // and StartToFinish, consider removing one or the other. |
766 if (scheme_type == URLPattern::SCHEME_HTTPS && | 766 if (scheme_type == URLPattern::SCHEME_HTTPS && |
767 navigation_state->was_npn_negotiated()) { | 767 document_state->was_npn_negotiated()) { |
768 UMA_HISTOGRAM_ENUMERATION( | 768 UMA_HISTOGRAM_ENUMERATION( |
769 base::FieldTrial::MakeName("PLT.Abandoned", "SpdyImpact"), | 769 base::FieldTrial::MakeName("PLT.Abandoned", "SpdyImpact"), |
770 abandoned_page ? 1 : 0, 2); | 770 abandoned_page ? 1 : 0, 2); |
771 switch (load_type) { | 771 switch (load_type) { |
772 case NavigationState::LINK_LOAD_NORMAL: | 772 case DocumentState::LINK_LOAD_NORMAL: |
773 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 773 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
774 "PLT.BeginToFinish_LinkLoadNormal", "SpdyImpact"), | 774 "PLT.BeginToFinish_LinkLoadNormal", "SpdyImpact"), |
775 begin_to_finish_all_loads); | 775 begin_to_finish_all_loads); |
776 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 776 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
777 "PLT.StartToFinish_LinkLoadNormal", "SpdyImpact"), | 777 "PLT.StartToFinish_LinkLoadNormal", "SpdyImpact"), |
778 start_to_finish_all_loads); | 778 start_to_finish_all_loads); |
779 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 779 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
780 "PLT.StartToCommit_LinkLoadNormal", "SpdyImpact"), | 780 "PLT.StartToCommit_LinkLoadNormal", "SpdyImpact"), |
781 start_to_commit); | 781 start_to_commit); |
782 break; | 782 break; |
783 case NavigationState::NORMAL_LOAD: | 783 case DocumentState::NORMAL_LOAD: |
784 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 784 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
785 "PLT.BeginToFinish_NormalLoad", "SpdyImpact"), | 785 "PLT.BeginToFinish_NormalLoad", "SpdyImpact"), |
786 begin_to_finish_all_loads); | 786 begin_to_finish_all_loads); |
787 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 787 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
788 "PLT.StartToFinish_NormalLoad", "SpdyImpact"), | 788 "PLT.StartToFinish_NormalLoad", "SpdyImpact"), |
789 start_to_finish_all_loads); | 789 start_to_finish_all_loads); |
790 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 790 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
791 "PLT.StartToCommit_NormalLoad", "SpdyImpact"), | 791 "PLT.StartToCommit_NormalLoad", "SpdyImpact"), |
792 start_to_commit); | 792 start_to_commit); |
793 break; | 793 break; |
794 default: | 794 default: |
795 break; | 795 break; |
796 } | 796 } |
797 } | 797 } |
798 | 798 |
799 // Histograms to compare the impact of alternate protocol over http | 799 // Histograms to compare the impact of alternate protocol over http |
800 // traffic: when spdy is used vs. when http is used. | 800 // traffic: when spdy is used vs. when http is used. |
801 if (scheme_type == URLPattern::SCHEME_HTTP && | 801 if (scheme_type == URLPattern::SCHEME_HTTP && |
802 navigation_state->was_alternate_protocol_available()) { | 802 document_state->was_alternate_protocol_available()) { |
803 if (!navigation_state->was_npn_negotiated()) { | 803 if (!document_state->was_npn_negotiated()) { |
804 // This means that even there is alternate protocols for npn_http or | 804 // This means that even there is alternate protocols for npn_http or |
805 // npn_spdy, they are not taken (due to the base::FieldTrial). | 805 // npn_spdy, they are not taken (due to the base::FieldTrial). |
806 switch (load_type) { | 806 switch (load_type) { |
807 case NavigationState::LINK_LOAD_NORMAL: | 807 case DocumentState::LINK_LOAD_NORMAL: |
808 PLT_HISTOGRAM( | 808 PLT_HISTOGRAM( |
809 "PLT.StartToFinish_LinkLoadNormal_AlternateProtocol_http", | 809 "PLT.StartToFinish_LinkLoadNormal_AlternateProtocol_http", |
810 start_to_finish_all_loads); | 810 start_to_finish_all_loads); |
811 PLT_HISTOGRAM( | 811 PLT_HISTOGRAM( |
812 "PLT.StartToCommit_LinkLoadNormal_AlternateProtocol_http", | 812 "PLT.StartToCommit_LinkLoadNormal_AlternateProtocol_http", |
813 start_to_commit); | 813 start_to_commit); |
814 break; | 814 break; |
815 case NavigationState::NORMAL_LOAD: | 815 case DocumentState::NORMAL_LOAD: |
816 PLT_HISTOGRAM( | 816 PLT_HISTOGRAM( |
817 "PLT.StartToFinish_NormalLoad_AlternateProtocol_http", | 817 "PLT.StartToFinish_NormalLoad_AlternateProtocol_http", |
818 start_to_finish_all_loads); | 818 start_to_finish_all_loads); |
819 PLT_HISTOGRAM( | 819 PLT_HISTOGRAM( |
820 "PLT.StartToCommit_NormalLoad_AlternateProtocol_http", | 820 "PLT.StartToCommit_NormalLoad_AlternateProtocol_http", |
821 start_to_commit); | 821 start_to_commit); |
822 break; | 822 break; |
823 default: | 823 default: |
824 break; | 824 break; |
825 } | 825 } |
826 } else if (navigation_state->was_fetched_via_spdy()) { | 826 } else if (document_state->was_fetched_via_spdy()) { |
827 switch (load_type) { | 827 switch (load_type) { |
828 case NavigationState::LINK_LOAD_NORMAL: | 828 case DocumentState::LINK_LOAD_NORMAL: |
829 PLT_HISTOGRAM( | 829 PLT_HISTOGRAM( |
830 "PLT.StartToFinish_LinkLoadNormal_AlternateProtocol_spdy", | 830 "PLT.StartToFinish_LinkLoadNormal_AlternateProtocol_spdy", |
831 start_to_finish_all_loads); | 831 start_to_finish_all_loads); |
832 PLT_HISTOGRAM( | 832 PLT_HISTOGRAM( |
833 "PLT.StartToCommit_LinkLoadNormal_AlternateProtocol_spdy", | 833 "PLT.StartToCommit_LinkLoadNormal_AlternateProtocol_spdy", |
834 start_to_commit); | 834 start_to_commit); |
835 break; | 835 break; |
836 case NavigationState::NORMAL_LOAD: | 836 case DocumentState::NORMAL_LOAD: |
837 PLT_HISTOGRAM( | 837 PLT_HISTOGRAM( |
838 "PLT.StartToFinish_NormalLoad_AlternateProtocol_spdy", | 838 "PLT.StartToFinish_NormalLoad_AlternateProtocol_spdy", |
839 start_to_finish_all_loads); | 839 start_to_finish_all_loads); |
840 PLT_HISTOGRAM( | 840 PLT_HISTOGRAM( |
841 "PLT.StartToCommit_NormalLoad_AlternateProtocol_spdy", | 841 "PLT.StartToCommit_NormalLoad_AlternateProtocol_spdy", |
842 start_to_commit); | 842 start_to_commit); |
843 break; | 843 break; |
844 default: | 844 default: |
845 break; | 845 break; |
846 } | 846 } |
847 } | 847 } |
848 } | 848 } |
849 } | 849 } |
850 } | 850 } |
851 | 851 |
852 // Record SpdyCwnd field trial results. | 852 // Record SpdyCwnd field trial results. |
853 if (navigation_state->was_fetched_via_spdy()) { | 853 if (document_state->was_fetched_via_spdy()) { |
854 switch (load_type) { | 854 switch (load_type) { |
855 case NavigationState::LINK_LOAD_NORMAL: | 855 case DocumentState::LINK_LOAD_NORMAL: |
856 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 856 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
857 "PLT.BeginToFinish_LinkLoadNormal", "SpdyCwnd"), | 857 "PLT.BeginToFinish_LinkLoadNormal", "SpdyCwnd"), |
858 begin_to_finish_all_loads); | 858 begin_to_finish_all_loads); |
859 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 859 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
860 "PLT.StartToFinish_LinkLoadNormal", "SpdyCwnd"), | 860 "PLT.StartToFinish_LinkLoadNormal", "SpdyCwnd"), |
861 start_to_finish_all_loads); | 861 start_to_finish_all_loads); |
862 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 862 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
863 "PLT.StartToCommit_LinkLoadNormal", "SpdyCwnd"), | 863 "PLT.StartToCommit_LinkLoadNormal", "SpdyCwnd"), |
864 start_to_commit); | 864 start_to_commit); |
865 break; | 865 break; |
866 case NavigationState::NORMAL_LOAD: | 866 case DocumentState::NORMAL_LOAD: |
867 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 867 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
868 "PLT.BeginToFinish_NormalLoad", "SpdyCwnd"), | 868 "PLT.BeginToFinish_NormalLoad", "SpdyCwnd"), |
869 begin_to_finish_all_loads); | 869 begin_to_finish_all_loads); |
870 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 870 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
871 "PLT.StartToFinish_NormalLoad", "SpdyCwnd"), | 871 "PLT.StartToFinish_NormalLoad", "SpdyCwnd"), |
872 start_to_finish_all_loads); | 872 start_to_finish_all_loads); |
873 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 873 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
874 "PLT.StartToCommit_NormalLoad", "SpdyCwnd"), | 874 "PLT.StartToCommit_NormalLoad", "SpdyCwnd"), |
875 start_to_commit); | 875 start_to_commit); |
876 break; | 876 break; |
877 default: | 877 default: |
878 break; | 878 break; |
879 } | 879 } |
880 } | 880 } |
881 | 881 |
882 // Record page load time and abandonment rates for proxy cases. | 882 // Record page load time and abandonment rates for proxy cases. |
883 if (navigation_state->was_fetched_via_proxy()) { | 883 if (document_state->was_fetched_via_proxy()) { |
884 if (scheme_type == URLPattern::SCHEME_HTTPS) { | 884 if (scheme_type == URLPattern::SCHEME_HTTPS) { |
885 PLT_HISTOGRAM("PLT.StartToFinish.Proxy.https", start_to_finish_all_loads); | 885 PLT_HISTOGRAM("PLT.StartToFinish.Proxy.https", start_to_finish_all_loads); |
886 UMA_HISTOGRAM_ENUMERATION("PLT.Abandoned.Proxy.https", | 886 UMA_HISTOGRAM_ENUMERATION("PLT.Abandoned.Proxy.https", |
887 abandoned_page ? 1 : 0, 2); | 887 abandoned_page ? 1 : 0, 2); |
888 } else { | 888 } else { |
889 DCHECK(scheme_type == URLPattern::SCHEME_HTTP); | 889 DCHECK(scheme_type == URLPattern::SCHEME_HTTP); |
890 PLT_HISTOGRAM("PLT.StartToFinish.Proxy.http", start_to_finish_all_loads); | 890 PLT_HISTOGRAM("PLT.StartToFinish.Proxy.http", start_to_finish_all_loads); |
891 UMA_HISTOGRAM_ENUMERATION("PLT.Abandoned.Proxy.http", | 891 UMA_HISTOGRAM_ENUMERATION("PLT.Abandoned.Proxy.http", |
892 abandoned_page ? 1 : 0, 2); | 892 abandoned_page ? 1 : 0, 2); |
893 } | 893 } |
(...skipping 12 matching lines...) Expand all Loading... |
906 } | 906 } |
907 } | 907 } |
908 | 908 |
909 // Site isolation metrics. | 909 // Site isolation metrics. |
910 UMA_HISTOGRAM_COUNTS("SiteIsolation.PageLoadsWithCrossSiteFrameAccess", | 910 UMA_HISTOGRAM_COUNTS("SiteIsolation.PageLoadsWithCrossSiteFrameAccess", |
911 cross_origin_access_count_); | 911 cross_origin_access_count_); |
912 UMA_HISTOGRAM_COUNTS("SiteIsolation.PageLoadsWithSameSiteFrameAccess", | 912 UMA_HISTOGRAM_COUNTS("SiteIsolation.PageLoadsWithSameSiteFrameAccess", |
913 same_origin_access_count_); | 913 same_origin_access_count_); |
914 | 914 |
915 // Log the PLT to the info log. | 915 // Log the PLT to the info log. |
916 LogPageLoadTime(navigation_state, frame->dataSource()); | 916 LogPageLoadTime(document_state, frame->dataSource()); |
917 | 917 |
918 // Record prerendering histograms. | 918 // Record prerendering histograms. |
919 prerender::PrerenderHelper::RecordHistograms(render_view(), | 919 prerender::PrerenderHelper::RecordHistograms(render_view(), |
920 finish_all_loads, | 920 finish_all_loads, |
921 begin_to_finish_all_loads); | 921 begin_to_finish_all_loads); |
922 | 922 |
923 // Since there are currently no guarantees that renderer histograms will be | 923 // Since there are currently no guarantees that renderer histograms will be |
924 // sent to the browser, we initiate a PostTask here to be sure that we send | 924 // sent to the browser, we initiate a PostTask here to be sure that we send |
925 // the histograms we generated. Without this call, pages that don't have an | 925 // the histograms we generated. Without this call, pages that don't have an |
926 // on-close-handler might generate data that is lost when the renderer is | 926 // on-close-handler might generate data that is lost when the renderer is |
(...skipping 15 matching lines...) Expand all Loading... |
942 } | 942 } |
943 | 943 |
944 void PageLoadHistograms::ClosePage() { | 944 void PageLoadHistograms::ClosePage() { |
945 // TODO(davemoore) This code should be removed once willClose() gets | 945 // TODO(davemoore) This code should be removed once willClose() gets |
946 // called when a page is destroyed. page_load_histograms_.Dump() is safe | 946 // called when a page is destroyed. page_load_histograms_.Dump() is safe |
947 // to call multiple times for the same frame, but it will simplify things. | 947 // to call multiple times for the same frame, but it will simplify things. |
948 Dump(render_view()->GetWebView()->mainFrame()); | 948 Dump(render_view()->GetWebView()->mainFrame()); |
949 ResetCrossFramePropertyAccess(); | 949 ResetCrossFramePropertyAccess(); |
950 } | 950 } |
951 | 951 |
952 void PageLoadHistograms::LogPageLoadTime(const NavigationState* state, | 952 void PageLoadHistograms::LogPageLoadTime(const DocumentState* document_state, |
953 const WebDataSource* ds) const { | 953 const WebDataSource* ds) const { |
954 // Because this function gets called on every page load, | 954 // Because this function gets called on every page load, |
955 // take extra care to optimize it away if logging is turned off. | 955 // take extra care to optimize it away if logging is turned off. |
956 if (logging::LOG_INFO < logging::GetMinLogLevel()) | 956 if (logging::LOG_INFO < logging::GetMinLogLevel()) |
957 return; | 957 return; |
958 | 958 |
959 DCHECK(state); | 959 DCHECK(document_state); |
960 DCHECK(ds); | 960 DCHECK(ds); |
961 GURL url(ds->request().url()); | 961 GURL url(ds->request().url()); |
962 Time start = state->start_load_time(); | 962 Time start = document_state->start_load_time(); |
963 Time finish = state->finish_load_time(); | 963 Time finish = document_state->finish_load_time(); |
964 // TODO(mbelshe): should we log more stats? | 964 // TODO(mbelshe): should we log more stats? |
965 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " | 965 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " |
966 << url.spec(); | 966 << url.spec(); |
967 } | 967 } |
OLD | NEW |