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

Side by Side Diff: ios/chrome/browser/ui/contextual_search/contextual_search_metrics.mm

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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ios/chrome/browser/ui/contextual_search/contextual_search_metrics.h" 5 #include "ios/chrome/browser/ui/contextual_search/contextual_search_metrics.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 11
12 #if !defined(__has_feature) || !__has_feature(objc_arc) 12 #if !defined(__has_feature) || !__has_feature(objc_arc)
13 #error "This file requires ARC support." 13 #error "This file requires ARC support."
14 #endif 14 #endif
15 15
16 using ContextualSearch::PanelState; 16 using ContextualSearch::PanelState;
17 using ContextualSearch::StateChangeReason; 17 using ContextualSearch::StateChangeReason;
18 18
19 // TODO(crbug.com/546238): Convert this into a class that is injected into 19 // TODO(crbug.com/546238): Convert this into a class that is injected into
20 // CSController so it can be mocked and tested. 20 // CSController so it can be mocked and tested.
21 21
22 #define VLOG_UMA_HISTOGRAM_ENUMERATION(log_level, name, sample) \ 22 #define VLOG_UMA_HISTOGRAM_ENUMERATION(log_level, name, sample) \
23 DVLOG(log_level) << (name) << ": " << (sample); 23 DVLOG(log_level) << (name) << ": " << (sample);
24 24
25 #define VLOG_UMA_HISTOGRAM_TIMES(log_level, name, sample) \ 25 #define VLOG_UMA_HISTOGRAM_TIMES(log_level, name, sample) \
26 DVLOG(log_level) << (name) << ": " << (sample).InMilliseconds(); 26 DVLOG(log_level) << (name) << ": " << (sample).InMilliseconds();
27 27
28 #define LOGGED_UMA_HISTOGRAM_ENUMERATION(name, sample, boundary, log_level) \ 28 #define LOGGED_UMA_HISTOGRAM_ENUMERATION(name, sample, boundary, log_level) \
29 { \ 29 { \
30 int evaluated_sample = sample; \ 30 auto evaluated_sample = static_cast<decltype(boundary)>(sample); \
31 VLOG_UMA_HISTOGRAM_ENUMERATION(log_level, name, evaluated_sample); \ 31 VLOG_UMA_HISTOGRAM_ENUMERATION(log_level, name, evaluated_sample); \
32 UMA_HISTOGRAM_ENUMERATION(name, evaluated_sample, boundary); \ 32 UMA_HISTOGRAM_ENUMERATION(name, evaluated_sample, boundary); \
33 } 33 }
34 34
35 #define LOGGED_UMA_HISTOGRAM_TIMES(name, sample, log_level) \ 35 #define LOGGED_UMA_HISTOGRAM_TIMES(name, sample, log_level) \
36 VLOG_UMA_HISTOGRAM_TIMES(log_level, name, sample); \ 36 VLOG_UMA_HISTOGRAM_TIMES(log_level, name, sample); \
37 UMA_HISTOGRAM_TIMES(name, sample); 37 UMA_HISTOGRAM_TIMES(name, sample);
38 38
39 namespace { 39 namespace {
40 // Constants used to log UMA "enum" histograms about the Contextual Search's 40 // Constants used to log UMA "enum" histograms about the Contextual Search's
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 EXIT_MAXIMIZED_TO_OTHER), 785 EXIT_MAXIMIZED_TO_OTHER),
786 EXIT_MAXIMIZED_TO_COUNT, 1); 786 EXIT_MAXIMIZED_TO_COUNT, 1);
787 break; 787 break;
788 default: 788 default:
789 NOTREACHED() << "RecordFirstStateExit for unexpected state " << to_state; 789 NOTREACHED() << "RecordFirstStateExit for unexpected state " << to_state;
790 break; 790 break;
791 } 791 }
792 } 792 }
793 793
794 } // namespace ContextualSearch 794 } // namespace ContextualSearch
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/browser_view_controller.mm ('k') | ios/chrome/browser/ui/sync/sync_util.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698