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

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

Issue 2690393004: Enable forced prerenders on wifi (Closed)
Patch Set: rename nit Created 3 years, 10 months 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 #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/logging.h" 10 #include "base/logging.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 case ORIGIN_LINK_REL_PRERENDER_CROSSDOMAIN: 64 case ORIGIN_LINK_REL_PRERENDER_CROSSDOMAIN:
65 return ComposeHistogramName("webcross", name); 65 return ComposeHistogramName("webcross", name);
66 case ORIGIN_EXTERNAL_REQUEST: 66 case ORIGIN_EXTERNAL_REQUEST:
67 return ComposeHistogramName("externalrequest", name); 67 return ComposeHistogramName("externalrequest", name);
68 case ORIGIN_INSTANT: 68 case ORIGIN_INSTANT:
69 return ComposeHistogramName("Instant", name); 69 return ComposeHistogramName("Instant", name);
70 case ORIGIN_LINK_REL_NEXT: 70 case ORIGIN_LINK_REL_NEXT:
71 return ComposeHistogramName("webnext", name); 71 return ComposeHistogramName("webnext", name);
72 case ORIGIN_GWS_PRERENDER: 72 case ORIGIN_GWS_PRERENDER:
73 return ComposeHistogramName("gws", name); 73 return ComposeHistogramName("gws", name);
74 case ORIGIN_EXTERNAL_REQUEST_FORCED_CELLULAR: 74 case ORIGIN_EXTERNAL_REQUEST_FORCED_PRERENDER:
75 return ComposeHistogramName("externalrequestforced", name); 75 return ComposeHistogramName("externalrequestforced", name);
76 case ORIGIN_OFFLINE: 76 case ORIGIN_OFFLINE:
77 return ComposeHistogramName("offline", name); 77 return ComposeHistogramName("offline", name);
78 default: 78 default:
79 NOTREACHED(); 79 NOTREACHED();
80 break; 80 break;
81 } 81 }
82 82
83 // Dummy return value to make the compiler happy. 83 // Dummy return value to make the compiler happy.
84 NOTREACHED(); 84 NOTREACHED();
(...skipping 13 matching lines...) Expand all
98 // Helper macros for origin-based histogram reporting. All HISTOGRAM arguments 98 // Helper macros for origin-based histogram reporting. All HISTOGRAM arguments
99 // must be UMA_HISTOGRAM... macros that contain an argument "name" which these 99 // must be UMA_HISTOGRAM... macros that contain an argument "name" which these
100 // macros will eventually substitute for the actual name used. 100 // macros will eventually substitute for the actual name used.
101 #define PREFIXED_HISTOGRAM(histogram_name, origin, HISTOGRAM) \ 101 #define PREFIXED_HISTOGRAM(histogram_name, origin, HISTOGRAM) \
102 PREFIXED_HISTOGRAM_INTERNAL(origin, IsOriginWash(), HISTOGRAM, histogram_name) 102 PREFIXED_HISTOGRAM_INTERNAL(origin, IsOriginWash(), HISTOGRAM, histogram_name)
103 103
104 #define PREFIXED_HISTOGRAM_ORIGIN_EXPERIMENT(histogram_name, origin, \ 104 #define PREFIXED_HISTOGRAM_ORIGIN_EXPERIMENT(histogram_name, origin, \
105 HISTOGRAM) \ 105 HISTOGRAM) \
106 PREFIXED_HISTOGRAM_INTERNAL(origin, false, HISTOGRAM, histogram_name) 106 PREFIXED_HISTOGRAM_INTERNAL(origin, false, HISTOGRAM, histogram_name)
107 107
108 #define PREFIXED_HISTOGRAM_INTERNAL(origin, wash, HISTOGRAM, histogram_name) \ 108 #define PREFIXED_HISTOGRAM_INTERNAL(origin, wash, HISTOGRAM, histogram_name) \
109 do { \ 109 do { \
110 { \ 110 { \
111 /* Do not rename. HISTOGRAM expects a local variable "name". */ \ 111 /* Do not rename. HISTOGRAM expects a local variable "name". */ \
112 std::string name = ComposeHistogramName(std::string(), histogram_name); \ 112 std::string name = ComposeHistogramName(std::string(), histogram_name); \
113 HISTOGRAM; \ 113 HISTOGRAM; \
114 } \ 114 } \
115 /* Do not rename. HISTOGRAM expects a local variable "name". */ \ 115 /* Do not rename. HISTOGRAM expects a local variable "name". */ \
116 std::string name = GetHistogramName(origin, wash, histogram_name); \ 116 std::string name = GetHistogramName(origin, wash, histogram_name); \
117 /* Branching because HISTOGRAM is caching the histogram into a static. */ \ 117 /* Branching because HISTOGRAM is caching the histogram into a static. */ \
118 if (wash) { \ 118 if (wash) { \
119 HISTOGRAM; \ 119 HISTOGRAM; \
120 } else if (origin == ORIGIN_OMNIBOX) { \ 120 } else if (origin == ORIGIN_OMNIBOX) { \
121 HISTOGRAM; \ 121 HISTOGRAM; \
122 } else if (origin == ORIGIN_NONE) { \ 122 } else if (origin == ORIGIN_NONE) { \
123 HISTOGRAM; \ 123 HISTOGRAM; \
124 } else if (origin == ORIGIN_LINK_REL_PRERENDER_SAMEDOMAIN) { \ 124 } else if (origin == ORIGIN_LINK_REL_PRERENDER_SAMEDOMAIN) { \
125 HISTOGRAM; \ 125 HISTOGRAM; \
126 } else if (origin == ORIGIN_LINK_REL_PRERENDER_CROSSDOMAIN) { \ 126 } else if (origin == ORIGIN_LINK_REL_PRERENDER_CROSSDOMAIN) { \
127 HISTOGRAM; \ 127 HISTOGRAM; \
128 } else if (origin == ORIGIN_EXTERNAL_REQUEST) { \ 128 } else if (origin == ORIGIN_EXTERNAL_REQUEST) { \
129 HISTOGRAM; \ 129 HISTOGRAM; \
130 } else if (origin == ORIGIN_INSTANT) { \ 130 } else if (origin == ORIGIN_INSTANT) { \
131 HISTOGRAM; \ 131 HISTOGRAM; \
132 } else if (origin == ORIGIN_LINK_REL_NEXT) { \ 132 } else if (origin == ORIGIN_LINK_REL_NEXT) { \
133 HISTOGRAM; \ 133 HISTOGRAM; \
134 } else if (origin == ORIGIN_EXTERNAL_REQUEST_FORCED_CELLULAR) { \ 134 } else if (origin == ORIGIN_EXTERNAL_REQUEST_FORCED_PRERENDER) { \
135 HISTOGRAM; \ 135 HISTOGRAM; \
136 } else if (origin == ORIGIN_OFFLINE) { \ 136 } else if (origin == ORIGIN_OFFLINE) { \
137 HISTOGRAM; \ 137 HISTOGRAM; \
138 } else { \ 138 } else { \
139 HISTOGRAM; \ 139 HISTOGRAM; \
140 } \ 140 } \
141 } while (0) 141 } while (0)
142 142
143 PrerenderHistograms::PrerenderHistograms() 143 PrerenderHistograms::PrerenderHistograms()
144 : last_origin_(ORIGIN_MAX), 144 : last_origin_(ORIGIN_MAX),
145 origin_wash_(false), 145 origin_wash_(false),
146 seen_any_pageload_(true), 146 seen_any_pageload_(true),
147 seen_pageload_started_after_prerender_(true) { 147 seen_pageload_started_after_prerender_(true) {
148 } 148 }
149 149
150 void PrerenderHistograms::RecordPrerender(Origin origin, const GURL& url) { 150 void PrerenderHistograms::RecordPrerender(Origin origin, const GURL& url) {
151 // We need to update last_origin_ and origin_wash_. 151 // We need to update last_origin_ and origin_wash_.
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 base::TimeDelta::FromMinutes(2), 50); 475 base::TimeDelta::FromMinutes(2), 50);
476 } 476 }
477 477
478 bool PrerenderHistograms::IsOriginWash() const { 478 bool PrerenderHistograms::IsOriginWash() const {
479 if (!WithinWindow()) 479 if (!WithinWindow())
480 return false; 480 return false;
481 return origin_wash_; 481 return origin_wash_;
482 } 482 }
483 483
484 } // namespace prerender 484 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/prerender/external_prerender_handler_android.cc ('k') | chrome/browser/prerender/prerender_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698