xref: /aosp_15_r20/external/libchrome/base/metrics/user_metrics_action.h (revision 635a864187cb8b6c713ff48b7e790a6b21769273)
1*635a8641SAndroid Build Coastguard Worker // Copyright 2014 The Chromium Authors. All rights reserved.
2*635a8641SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
3*635a8641SAndroid Build Coastguard Worker // found in the LICENSE file.
4*635a8641SAndroid Build Coastguard Worker 
5*635a8641SAndroid Build Coastguard Worker #ifndef BASE_METRICS_USER_METRICS_ACTION_H_
6*635a8641SAndroid Build Coastguard Worker #define BASE_METRICS_USER_METRICS_ACTION_H_
7*635a8641SAndroid Build Coastguard Worker 
8*635a8641SAndroid Build Coastguard Worker namespace base {
9*635a8641SAndroid Build Coastguard Worker 
10*635a8641SAndroid Build Coastguard Worker // UserMetricsAction exists purely to standardize on the parameters passed to
11*635a8641SAndroid Build Coastguard Worker // UserMetrics. That way, our toolset can scan the source code reliable for
12*635a8641SAndroid Build Coastguard Worker // constructors and extract the associated string constants.
13*635a8641SAndroid Build Coastguard Worker // WARNING: When using UserMetricsAction you should use a string literal
14*635a8641SAndroid Build Coastguard Worker // parameter e.g.
15*635a8641SAndroid Build Coastguard Worker //   RecordAction(UserMetricsAction("my action name"));
16*635a8641SAndroid Build Coastguard Worker // This ensures that our processing scripts can associate this action's hash
17*635a8641SAndroid Build Coastguard Worker // with its metric name. Therefore, it will be possible to retrieve the metric
18*635a8641SAndroid Build Coastguard Worker // name from the hash later on.
19*635a8641SAndroid Build Coastguard Worker // Please see tools/metrics/actions/extract_actions.py for details.
20*635a8641SAndroid Build Coastguard Worker struct UserMetricsAction {
21*635a8641SAndroid Build Coastguard Worker   const char* str_;
UserMetricsActionUserMetricsAction22*635a8641SAndroid Build Coastguard Worker   explicit constexpr UserMetricsAction(const char* str) noexcept : str_(str) {}
23*635a8641SAndroid Build Coastguard Worker };
24*635a8641SAndroid Build Coastguard Worker 
25*635a8641SAndroid Build Coastguard Worker }  // namespace base
26*635a8641SAndroid Build Coastguard Worker 
27*635a8641SAndroid Build Coastguard Worker #endif  // BASE_METRICS_USER_METRICS_ACTION_H_
28