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

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

Issue 10933065: Separate same domain and cross domain <link rel=...> prerenders for reporting. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: remediate in prep for CQ... Created 8 years, 2 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 | Annotate | Revision Log
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/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 return ComposeHistogramName("exp" + std::string(1, experiment_id + '0'), 45 return ComposeHistogramName("exp" + std::string(1, experiment_id + '0'),
46 name); 46 name);
47 } 47 }
48 48
49 if (experiment_id != kNoExperiment) 49 if (experiment_id != kNoExperiment)
50 return ComposeHistogramName("wash", name); 50 return ComposeHistogramName("wash", name);
51 51
52 switch (origin) { 52 switch (origin) {
53 case ORIGIN_OMNIBOX: 53 case ORIGIN_OMNIBOX:
54 return ComposeHistogramName("omnibox", name); 54 return ComposeHistogramName("omnibox", name);
55 case ORIGIN_LINK_REL_PRERENDER:
56 return ComposeHistogramName("web", name);
57 case ORIGIN_NONE: 55 case ORIGIN_NONE:
dominich 2012/10/17 21:04:22 is it valid to have no origin?
58 return ComposeHistogramName("none", name); 56 return ComposeHistogramName("none", name);
57 case ORIGIN_LINK_REL_PRERENDER_SAMEDOMAIN:
58 return ComposeHistogramName("websame", name);
59 case ORIGIN_LINK_REL_PRERENDER_CROSSDOMAIN:
60 return ComposeHistogramName("webcross", name);
59 case ORIGIN_GWS_PRERENDER: // Handled above. 61 case ORIGIN_GWS_PRERENDER: // Handled above.
60 default: 62 default:
61 NOTREACHED(); 63 NOTREACHED();
62 break; 64 break;
63 }; 65 };
64 66
65 // Dummy return value to make the compiler happy. 67 // Dummy return value to make the compiler happy.
66 NOTREACHED(); 68 NOTREACHED();
67 return ComposeHistogramName("wash", name); 69 return ComposeHistogramName("wash", name);
68 } 70 }
(...skipping 29 matching lines...) Expand all
98 std::string name = GetHistogramName(origin, experiment, wash, \ 100 std::string name = GetHistogramName(origin, experiment, wash, \
99 histogram_name); \ 101 histogram_name); \
100 static uint8 recording_experiment = kNoExperiment; \ 102 static uint8 recording_experiment = kNoExperiment; \
101 if (recording_experiment == kNoExperiment && experiment != kNoExperiment) \ 103 if (recording_experiment == kNoExperiment && experiment != kNoExperiment) \
102 recording_experiment = experiment; \ 104 recording_experiment = experiment; \
103 if (wash) { \ 105 if (wash) { \
104 HISTOGRAM; \ 106 HISTOGRAM; \
105 } else if (experiment != kNoExperiment && \ 107 } else if (experiment != kNoExperiment && \
106 (origin != ORIGIN_GWS_PRERENDER || \ 108 (origin != ORIGIN_GWS_PRERENDER || \
107 experiment != recording_experiment)) { \ 109 experiment != recording_experiment)) { \
108 } else if (origin == ORIGIN_LINK_REL_PRERENDER) { \
109 HISTOGRAM; \
110 } else if (origin == ORIGIN_OMNIBOX) { \ 110 } else if (origin == ORIGIN_OMNIBOX) { \
111 HISTOGRAM; \ 111 HISTOGRAM; \
112 } else if (origin == ORIGIN_NONE) { \ 112 } else if (origin == ORIGIN_NONE) { \
113 HISTOGRAM; \ 113 HISTOGRAM; \
114 } else if (origin == ORIGIN_LINK_REL_PRERENDER_SAMEDOMAIN) { \
115 HISTOGRAM; \
116 } else if (origin == ORIGIN_LINK_REL_PRERENDER_CROSSDOMAIN) { \
117 HISTOGRAM; \
114 } else if (experiment != kNoExperiment) { \ 118 } else if (experiment != kNoExperiment) { \
115 HISTOGRAM; \ 119 HISTOGRAM; \
116 } else { \ 120 } else { \
117 HISTOGRAM; \ 121 HISTOGRAM; \
118 } \ 122 } \
119 } 123 }
120 124
121 PrerenderHistograms::PrerenderHistograms() 125 PrerenderHistograms::PrerenderHistograms()
122 : last_experiment_id_(kNoExperiment), 126 : last_experiment_id_(kNoExperiment),
123 last_origin_(ORIGIN_LINK_REL_PRERENDER), 127 last_origin_(ORIGIN_MAX),
dominich 2012/10/17 21:04:22 why is ORIGIN_NONE != ORIGIN_MAX? This suggests th
124 origin_experiment_wash_(false), 128 origin_experiment_wash_(false),
125 seen_any_pageload_(true), 129 seen_any_pageload_(true),
126 seen_pageload_started_after_prerender_(true) { 130 seen_pageload_started_after_prerender_(true) {
127 } 131 }
128 132
129 void PrerenderHistograms::RecordPrerender(Origin origin, const GURL& url) { 133 void PrerenderHistograms::RecordPrerender(Origin origin, const GURL& url) {
130 // Check if we are doing an experiment. 134 // Check if we are doing an experiment.
131 uint8 experiment = GetQueryStringBasedExperiment(url); 135 uint8 experiment = GetQueryStringBasedExperiment(url);
132 136
133 // We need to update last_experiment_id_, last_origin_, and 137 // We need to update last_experiment_id_, last_origin_, and
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 return last_experiment_id_; 391 return last_experiment_id_;
388 } 392 }
389 393
390 bool PrerenderHistograms::IsOriginExperimentWash() const { 394 bool PrerenderHistograms::IsOriginExperimentWash() const {
391 if (!WithinWindow()) 395 if (!WithinWindow())
392 return false; 396 return false;
393 return origin_experiment_wash_; 397 return origin_experiment_wash_;
394 } 398 }
395 399
396 } // namespace prerender 400 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_browsertest.cc ('k') | chrome/browser/prerender/prerender_history_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698