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

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

Issue 1854643002: Implement PrerenderManager::AddPrerenderForOffline() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses pasko' comments Created 4 years, 8 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/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 29 matching lines...) Expand all
40 switch (origin) { 40 switch (origin) {
41 case ORIGIN_OMNIBOX: 41 case ORIGIN_OMNIBOX:
42 return ComposeHistogramName("omnibox", name); 42 return ComposeHistogramName("omnibox", name);
43 case ORIGIN_NONE: 43 case ORIGIN_NONE:
44 return ComposeHistogramName("none", name); 44 return ComposeHistogramName("none", name);
45 case ORIGIN_LINK_REL_PRERENDER_SAMEDOMAIN: 45 case ORIGIN_LINK_REL_PRERENDER_SAMEDOMAIN:
46 return ComposeHistogramName("websame", name); 46 return ComposeHistogramName("websame", name);
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: 57 case ORIGIN_EXTERNAL_REQUEST_FORCED_CELLULAR:
58 return ComposeHistogramName("externalrequestforced", name); 58 return ComposeHistogramName("externalrequestforced", name);
59 case ORIGIN_OFFLINE:
60 return ComposeHistogramName("offline", name);
59 default: 61 default:
60 NOTREACHED(); 62 NOTREACHED();
61 break; 63 break;
62 } 64 }
63 65
64 // Dummy return value to make the compiler happy. 66 // Dummy return value to make the compiler happy.
65 NOTREACHED(); 67 NOTREACHED();
66 return ComposeHistogramName("wash", name); 68 return ComposeHistogramName("wash", name);
67 } 69 }
68 70
(...skipping 15 matching lines...) Expand all
84 86
85 #define PREFIXED_HISTOGRAM_INTERNAL(origin, wash, HISTOGRAM, histogram_name) \ 87 #define PREFIXED_HISTOGRAM_INTERNAL(origin, wash, HISTOGRAM, histogram_name) \
86 do { \ 88 do { \
87 { \ 89 { \
88 /* Do not rename. HISTOGRAM expects a local variable "name". */ \ 90 /* Do not rename. HISTOGRAM expects a local variable "name". */ \
89 std::string name = ComposeHistogramName(std::string(), histogram_name); \ 91 std::string name = ComposeHistogramName(std::string(), histogram_name); \
90 HISTOGRAM; \ 92 HISTOGRAM; \
91 } \ 93 } \
92 /* Do not rename. HISTOGRAM expects a local variable "name". */ \ 94 /* Do not rename. HISTOGRAM expects a local variable "name". */ \
93 std::string name = GetHistogramName(origin, wash, histogram_name); \ 95 std::string name = GetHistogramName(origin, wash, histogram_name); \
96 /* Branching because HISTOGRAM is caching the histogram into a static. */ \
94 if (wash) { \ 97 if (wash) { \
95 HISTOGRAM; \ 98 HISTOGRAM; \
96 } else if (origin == ORIGIN_OMNIBOX) { \ 99 } else if (origin == ORIGIN_OMNIBOX) { \
97 HISTOGRAM; \ 100 HISTOGRAM; \
98 } else if (origin == ORIGIN_NONE) { \ 101 } else if (origin == ORIGIN_NONE) { \
99 HISTOGRAM; \ 102 HISTOGRAM; \
100 } else if (origin == ORIGIN_LINK_REL_PRERENDER_SAMEDOMAIN) { \ 103 } else if (origin == ORIGIN_LINK_REL_PRERENDER_SAMEDOMAIN) { \
101 HISTOGRAM; \ 104 HISTOGRAM; \
102 } else if (origin == ORIGIN_LINK_REL_PRERENDER_CROSSDOMAIN) { \ 105 } else if (origin == ORIGIN_LINK_REL_PRERENDER_CROSSDOMAIN) { \
103 HISTOGRAM; \ 106 HISTOGRAM; \
104 } else if (origin == ORIGIN_EXTERNAL_REQUEST) { \ 107 } else if (origin == ORIGIN_EXTERNAL_REQUEST) { \
105 HISTOGRAM; \ 108 HISTOGRAM; \
106 } else if (origin == ORIGIN_INSTANT) { \ 109 } else if (origin == ORIGIN_INSTANT) { \
107 HISTOGRAM; \ 110 HISTOGRAM; \
108 } else if (origin == ORIGIN_LINK_REL_NEXT) { \ 111 } else if (origin == ORIGIN_LINK_REL_NEXT) { \
109 HISTOGRAM; \ 112 HISTOGRAM; \
110 } else if (origin == ORIGIN_EXTERNAL_REQUEST_FORCED_CELLULAR) { \ 113 } else if (origin == ORIGIN_EXTERNAL_REQUEST_FORCED_CELLULAR) { \
111 HISTOGRAM; \ 114 HISTOGRAM; \
115 } else if (origin == ORIGIN_OFFLINE) { \
116 HISTOGRAM; \
112 } else { \ 117 } else { \
113 HISTOGRAM; \ 118 HISTOGRAM; \
114 } \ 119 } \
115 } while (0) 120 } while (0)
116 121
117 PrerenderHistograms::PrerenderHistograms() 122 PrerenderHistograms::PrerenderHistograms()
118 : last_origin_(ORIGIN_MAX), 123 : last_origin_(ORIGIN_MAX),
119 origin_wash_(false), 124 origin_wash_(false),
120 seen_any_pageload_(true), 125 seen_any_pageload_(true),
121 seen_pageload_started_after_prerender_(true) { 126 seen_pageload_started_after_prerender_(true) {
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 } 400 }
396 } 401 }
397 402
398 bool PrerenderHistograms::IsOriginWash() const { 403 bool PrerenderHistograms::IsOriginWash() const {
399 if (!WithinWindow()) 404 if (!WithinWindow())
400 return false; 405 return false;
401 return origin_wash_; 406 return origin_wash_;
402 } 407 }
403 408
404 } // namespace prerender 409 } // namespace prerender
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698