| 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/browser/prerender/prerender_util.h" | 5 #include "chrome/browser/prerender/prerender_util.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/metrics/sparse_histogram.h" | 9 #include "base/metrics/sparse_histogram.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 bool IsNoSwapInExperiment(uint8 experiment_id) { | 156 bool IsNoSwapInExperiment(uint8 experiment_id) { |
| 157 // Currently, experiments 5 and 6 fall in this category. | 157 // Currently, experiments 5 and 6 fall in this category. |
| 158 return experiment_id == 5 || experiment_id == 6; | 158 return experiment_id == 5 || experiment_id == 6; |
| 159 } | 159 } |
| 160 | 160 |
| 161 bool IsControlGroupExperiment(uint8 experiment_id) { | 161 bool IsControlGroupExperiment(uint8 experiment_id) { |
| 162 // Currently, experiments 7 and 8 fall in this category. | 162 // Currently, experiments 7 and 8 fall in this category. |
| 163 return experiment_id == 7 || experiment_id == 8; | 163 return experiment_id == 7 || experiment_id == 8; |
| 164 } | 164 } |
| 165 | 165 |
| 166 void GatherPagespeedData(const ResourceType::Type resource_type, | 166 void GatherPagespeedData(const ResourceType resource_type, |
| 167 const GURL& request_url, | 167 const GURL& request_url, |
| 168 const net::HttpResponseHeaders* response_headers) { | 168 const net::HttpResponseHeaders* response_headers) { |
| 169 if (resource_type != ResourceType::MAIN_FRAME || | 169 if (resource_type != content::RESOURCE_TYPE_MAIN_FRAME || |
| 170 !request_url.SchemeIsHTTPOrHTTPS()) | 170 !request_url.SchemeIsHTTPOrHTTPS()) |
| 171 return; | 171 return; |
| 172 | 172 |
| 173 // bucket 0 counts every response seen. | 173 // bucket 0 counts every response seen. |
| 174 UMA_HISTOGRAM_ENUMERATION(kPagespeedServerHistogram, | 174 UMA_HISTOGRAM_ENUMERATION(kPagespeedServerHistogram, |
| 175 PAGESPEED_TOTAL_RESPONSES, | 175 PAGESPEED_TOTAL_RESPONSES, |
| 176 PAGESPEED_SERVER_MAXIMUM); | 176 PAGESPEED_SERVER_MAXIMUM); |
| 177 if (!response_headers) | 177 if (!response_headers) |
| 178 return; | 178 return; |
| 179 | 179 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 ReportPrerenderSchemeCancelReason( | 264 ReportPrerenderSchemeCancelReason( |
| 265 PRERENDER_SCHEME_CANCEL_REASON_CHROME_EXTENSION); | 265 PRERENDER_SCHEME_CANCEL_REASON_CHROME_EXTENSION); |
| 266 } else if (url.SchemeIs("about")) { | 266 } else if (url.SchemeIs("about")) { |
| 267 ReportPrerenderSchemeCancelReason(PRERENDER_SCHEME_CANCEL_REASON_ABOUT); | 267 ReportPrerenderSchemeCancelReason(PRERENDER_SCHEME_CANCEL_REASON_ABOUT); |
| 268 } else { | 268 } else { |
| 269 ReportPrerenderSchemeCancelReason(PRERENDER_SCHEME_CANCEL_REASON_UNKNOWN); | 269 ReportPrerenderSchemeCancelReason(PRERENDER_SCHEME_CANCEL_REASON_UNKNOWN); |
| 270 } | 270 } |
| 271 } | 271 } |
| 272 | 272 |
| 273 } // namespace prerender | 273 } // namespace prerender |
| OLD | NEW |