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

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: 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 | « no previous file | tools/metrics/histograms/histograms.xml » ('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 2221 matching lines...) Expand 10 before | Expand all | Expand 10 after
2232 content::RecordComputedAction(action); 2232 content::RecordComputedAction(action);
2233 } 2233 }
2234 // Since flag metrics are recorded every startup, add a tick so that the 2234 // Since flag metrics are recorded every startup, add a tick so that the
2235 // stats can be made meaningful. 2235 // stats can be made meaningful.
2236 if (flags.size()) 2236 if (flags.size())
2237 content::RecordAction(UserMetricsAction("AboutFlags_StartupTick")); 2237 content::RecordAction(UserMetricsAction("AboutFlags_StartupTick"));
2238 content::RecordAction(UserMetricsAction("StartupTick")); 2238 content::RecordAction(UserMetricsAction("StartupTick"));
2239 } 2239 }
2240 2240
2241 uint32_t GetSwitchUMAId(const std::string& switch_name) { 2241 uint32_t GetSwitchUMAId(const std::string& switch_name) {
2242 return static_cast<uint32_t>(metrics::HashMetricName(switch_name)); 2242 // Need to strip sign bit.
sky 2014/08/27 20:24:53 You need a better comment. Document 'why' we need
Alexander Alekseev 2014/08/28 02:48:55 Done.
2243 return static_cast<uint32_t>(metrics::HashMetricName(switch_name)) &
Ilya Sherman 2014/08/27 22:05:20 Why not just static_cast to <int32_t>? That has t
Alexander Alekseev 2014/08/28 02:48:55 static_cast<int32_t>((uint64_t)(-1LL)) == -1 So I
Ilya Sherman 2014/08/28 03:49:57 I don't understand the problem. What's wrong with
Alexander Alekseev 2014/08/28 14:40:52 Except that it is unnatural, nothing wrong. Done.
2244 std::numeric_limits<int32_t>::max();
2243 } 2245 }
2244 2246
2245 void ReportCustomFlags(const std::string& uma_histogram_hame, 2247 void ReportCustomFlags(const std::string& uma_histogram_hame,
2246 const std::set<std::string>& command_line_difference) { 2248 const std::set<std::string>& command_line_difference) {
2247 for (std::set<std::string>::const_iterator it = 2249 for (std::set<std::string>::const_iterator it =
2248 command_line_difference.begin(); 2250 command_line_difference.begin();
2249 it != command_line_difference.end(); 2251 it != command_line_difference.end();
2250 ++it) { 2252 ++it) {
2251 int uma_id = about_flags::kBadSwitchFormatHistogramId; 2253 int uma_id = about_flags::kBadSwitchFormatHistogramId;
2252 if (StartsWithASCII(*it, "--", true /* case_sensitive */)) { 2254 if (StartsWithASCII(*it, "--", true /* case_sensitive */)) {
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
2464 } 2466 }
2465 2467
2466 const Experiment* GetExperiments(size_t* count) { 2468 const Experiment* GetExperiments(size_t* count) {
2467 *count = num_experiments; 2469 *count = num_experiments;
2468 return experiments; 2470 return experiments;
2469 } 2471 }
2470 2472
2471 } // namespace testing 2473 } // namespace testing
2472 2474
2473 } // namespace about_flags 2475 } // namespace about_flags
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698