| OLD | NEW |
| 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 #include "chrome/browser/prerender/prerender_histograms.h" | 5 #include "chrome/browser/prerender/prerender_histograms.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 case ORIGIN_LINK_REL_PRERENDER_CROSSDOMAIN: | 47 case ORIGIN_LINK_REL_PRERENDER_CROSSDOMAIN: |
| 48 return ComposeHistogramName("webcross", name); | 48 return ComposeHistogramName("webcross", name); |
| 49 case ORIGIN_EXTERNAL_REQUEST: | 49 case ORIGIN_EXTERNAL_REQUEST: |
| 50 return ComposeHistogramName("externalrequest", name); | 50 return ComposeHistogramName("externalrequest", name); |
| 51 case ORIGIN_INSTANT: | 51 case ORIGIN_INSTANT: |
| 52 return ComposeHistogramName("Instant", name); | 52 return ComposeHistogramName("Instant", name); |
| 53 case ORIGIN_LINK_REL_NEXT: | 53 case ORIGIN_LINK_REL_NEXT: |
| 54 return ComposeHistogramName("webnext", name); | 54 return ComposeHistogramName("webnext", name); |
| 55 case ORIGIN_GWS_PRERENDER: | 55 case ORIGIN_GWS_PRERENDER: |
| 56 return ComposeHistogramName("gws", name); | 56 return ComposeHistogramName("gws", name); |
| 57 case ORIGIN_EXTERNAL_REQUEST_FORCED_CELLULAR: |
| 58 return ComposeHistogramName("externalrequestforced", name); |
| 57 default: | 59 default: |
| 58 NOTREACHED(); | 60 NOTREACHED(); |
| 59 break; | 61 break; |
| 60 } | 62 } |
| 61 | 63 |
| 62 // Dummy return value to make the compiler happy. | 64 // Dummy return value to make the compiler happy. |
| 63 NOTREACHED(); | 65 NOTREACHED(); |
| 64 return ComposeHistogramName("wash", name); | 66 return ComposeHistogramName("wash", name); |
| 65 } | 67 } |
| 66 | 68 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 } else if (origin == ORIGIN_LINK_REL_PRERENDER_SAMEDOMAIN) { \ | 100 } else if (origin == ORIGIN_LINK_REL_PRERENDER_SAMEDOMAIN) { \ |
| 99 HISTOGRAM; \ | 101 HISTOGRAM; \ |
| 100 } else if (origin == ORIGIN_LINK_REL_PRERENDER_CROSSDOMAIN) { \ | 102 } else if (origin == ORIGIN_LINK_REL_PRERENDER_CROSSDOMAIN) { \ |
| 101 HISTOGRAM; \ | 103 HISTOGRAM; \ |
| 102 } else if (origin == ORIGIN_EXTERNAL_REQUEST) { \ | 104 } else if (origin == ORIGIN_EXTERNAL_REQUEST) { \ |
| 103 HISTOGRAM; \ | 105 HISTOGRAM; \ |
| 104 } else if (origin == ORIGIN_INSTANT) { \ | 106 } else if (origin == ORIGIN_INSTANT) { \ |
| 105 HISTOGRAM; \ | 107 HISTOGRAM; \ |
| 106 } else if (origin == ORIGIN_LINK_REL_NEXT) { \ | 108 } else if (origin == ORIGIN_LINK_REL_NEXT) { \ |
| 107 HISTOGRAM; \ | 109 HISTOGRAM; \ |
| 110 } else if (origin == ORIGIN_EXTERNAL_REQUEST_FORCED_CELLULAR) { \ |
| 111 HISTOGRAM; \ |
| 108 } else { \ | 112 } else { \ |
| 109 HISTOGRAM; \ | 113 HISTOGRAM; \ |
| 110 } \ | 114 } \ |
| 111 } while (0) | 115 } while (0) |
| 112 | 116 |
| 113 PrerenderHistograms::PrerenderHistograms() | 117 PrerenderHistograms::PrerenderHistograms() |
| 114 : last_origin_(ORIGIN_MAX), | 118 : last_origin_(ORIGIN_MAX), |
| 115 origin_wash_(false), | 119 origin_wash_(false), |
| 116 seen_any_pageload_(true), | 120 seen_any_pageload_(true), |
| 117 seen_pageload_started_after_prerender_(true) { | 121 seen_pageload_started_after_prerender_(true) { |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 } | 395 } |
| 392 } | 396 } |
| 393 | 397 |
| 394 bool PrerenderHistograms::IsOriginWash() const { | 398 bool PrerenderHistograms::IsOriginWash() const { |
| 395 if (!WithinWindow()) | 399 if (!WithinWindow()) |
| 396 return false; | 400 return false; |
| 397 return origin_wash_; | 401 return origin_wash_; |
| 398 } | 402 } |
| 399 | 403 |
| 400 } // namespace prerender | 404 } // namespace prerender |
| OLD | NEW |