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

Side by Side Diff: chrome/browser/about_flags.cc

Issue 509923003: about_flags::ReportCustomFlags() should use signed 32-bit IDs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup. Created 6 years, 3 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
« no previous file with comments | « chrome/browser/about_flags.h ('k') | chrome/browser/about_flags_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/about_flags.h" 5 #include "chrome/browser/about_flags.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 #endif 60 #endif
61 61
62 #if defined(ENABLE_APP_LIST) 62 #if defined(ENABLE_APP_LIST)
63 #include "ui/app_list/app_list_switches.h" 63 #include "ui/app_list/app_list_switches.h"
64 #endif 64 #endif
65 65
66 using base::UserMetricsAction; 66 using base::UserMetricsAction;
67 67
68 namespace about_flags { 68 namespace about_flags {
69 69
70 const uint32_t kBadSwitchFormatHistogramId = 0; 70 const base::HistogramBase::Sample kBadSwitchFormatHistogramId = 0;
71 71
72 // Macros to simplify specifying the type. 72 // Macros to simplify specifying the type.
73 #define SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, switch_value) \ 73 #define SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, switch_value) \
74 Experiment::SINGLE_VALUE, \ 74 Experiment::SINGLE_VALUE, \
75 command_line_switch, switch_value, NULL, NULL, NULL, 0 75 command_line_switch, switch_value, NULL, NULL, NULL, 0
76 #define SINGLE_VALUE_TYPE(command_line_switch) \ 76 #define SINGLE_VALUE_TYPE(command_line_switch) \
77 SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, "") 77 SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, "")
78 #define ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(enable_switch, enable_value, \ 78 #define ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(enable_switch, enable_value, \
79 disable_switch, disable_value) \ 79 disable_switch, disable_value) \
80 Experiment::ENABLE_DISABLE_VALUE, enable_switch, enable_value, \ 80 Experiment::ENABLE_DISABLE_VALUE, enable_switch, enable_value, \
(...skipping 2177 matching lines...) Expand 10 before | Expand all | Expand 10 after
2258 action += *it; 2258 action += *it;
2259 content::RecordComputedAction(action); 2259 content::RecordComputedAction(action);
2260 } 2260 }
2261 // Since flag metrics are recorded every startup, add a tick so that the 2261 // Since flag metrics are recorded every startup, add a tick so that the
2262 // stats can be made meaningful. 2262 // stats can be made meaningful.
2263 if (flags.size()) 2263 if (flags.size())
2264 content::RecordAction(UserMetricsAction("AboutFlags_StartupTick")); 2264 content::RecordAction(UserMetricsAction("AboutFlags_StartupTick"));
2265 content::RecordAction(UserMetricsAction("StartupTick")); 2265 content::RecordAction(UserMetricsAction("StartupTick"));
2266 } 2266 }
2267 2267
2268 uint32_t GetSwitchUMAId(const std::string& switch_name) { 2268 base::HistogramBase::Sample GetSwitchUMAId(const std::string& switch_name) {
2269 return static_cast<uint32_t>(metrics::HashMetricName(switch_name)); 2269 return static_cast<base::HistogramBase::Sample>(
2270 metrics::HashMetricName(switch_name));
2270 } 2271 }
2271 2272
2272 void ReportCustomFlags(const std::string& uma_histogram_hame, 2273 void ReportCustomFlags(const std::string& uma_histogram_hame,
2273 const std::set<std::string>& command_line_difference) { 2274 const std::set<std::string>& command_line_difference) {
2274 for (std::set<std::string>::const_iterator it = 2275 for (std::set<std::string>::const_iterator it =
2275 command_line_difference.begin(); 2276 command_line_difference.begin();
2276 it != command_line_difference.end(); 2277 it != command_line_difference.end();
2277 ++it) { 2278 ++it) {
2278 int uma_id = about_flags::kBadSwitchFormatHistogramId; 2279 int uma_id = about_flags::kBadSwitchFormatHistogramId;
2279 if (StartsWithASCII(*it, "--", true /* case_sensitive */)) { 2280 if (StartsWithASCII(*it, "--", true /* case_sensitive */)) {
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
2491 } 2492 }
2492 2493
2493 const Experiment* GetExperiments(size_t* count) { 2494 const Experiment* GetExperiments(size_t* count) {
2494 *count = num_experiments; 2495 *count = num_experiments;
2495 return experiments; 2496 return experiments;
2496 } 2497 }
2497 2498
2498 } // namespace testing 2499 } // namespace testing
2499 2500
2500 } // namespace about_flags 2501 } // namespace about_flags
OLDNEW
« no previous file with comments | « chrome/browser/about_flags.h ('k') | chrome/browser/about_flags_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698