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

Unified Diff: chrome/browser/engagement/important_sites_util.cc

Issue 2886933003: Use stricter type checking in UMA_HISTOGRAM_ENUMERATION (Closed)
Patch Set: simplify type checking Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/engagement/important_sites_util.cc
diff --git a/chrome/browser/engagement/important_sites_util.cc b/chrome/browser/engagement/important_sites_util.cc
index 09dd03258bd673f5cb4291815d598ec5ee951e29..97211a4638948cad10ff83bd037e201515ddaffe 100644
--- a/chrome/browser/engagement/important_sites_util.cc
+++ b/chrome/browser/engagement/important_sites_util.cc
@@ -56,20 +56,21 @@ static const int kMaxBookmarks = 5;
// We need this to be a macro, as the histogram macros cache their pointers
// after the first call, so when we change the uma name we check fail if we're
// just a method.
-#define RECORD_UMA_FOR_IMPORTANT_REASON(uma_name, uma_count_name, \
- reason_bitfield) \
- do { \
- int count = 0; \
- int32_t bitfield = (reason_bitfield); \
- for (int i = 0; i < ImportantReason::REASON_BOUNDARY; i++) { \
- if ((bitfield >> i) & 1) { \
- count++; \
- UMA_HISTOGRAM_ENUMERATION((uma_name), i, \
- ImportantReason::REASON_BOUNDARY); \
- } \
- } \
- UMA_HISTOGRAM_ENUMERATION((uma_count_name), count, \
- ImportantReason::REASON_BOUNDARY); \
+#define RECORD_UMA_FOR_IMPORTANT_REASON(uma_name, uma_count_name, \
+ reason_bitfield) \
+ do { \
+ int count = 0; \
+ int32_t bitfield = (reason_bitfield); \
+ for (int i = 0; i < ImportantReason::REASON_BOUNDARY; i++) { \
+ if ((bitfield >> i) & 1) { \
+ count++; \
+ UMA_HISTOGRAM_ENUMERATION((uma_name), static_cast<ImportantReason>(i), \
+ ImportantReason::REASON_BOUNDARY); \
+ } \
+ } \
+ UMA_HISTOGRAM_EXACT_LINEAR( \
+ (uma_count_name), count, \
+ static_cast<int>(ImportantReason::REASON_BOUNDARY)); \
} while (0)
// Do not change the values here, as they are used for UMA histograms and
« no previous file with comments | « chrome/browser/diagnostics/diagnostics_test.cc ('k') | chrome/browser/media/android/remote/record_cast_action.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698