OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | |
Alexei Svitkine (slow)
2016/10/28 15:39:17
Nit: No (c) for new files
lawrencewu
2016/10/28 16:54:29
Done.
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef BASE_METRICS_FIELD_TRIAL_PARAM_ASSOCIATOR_H_ | |
6 #define BASE_METRICS_FIELD_TRIAL_PARAM_ASSOCIATOR_H_ | |
7 | |
8 #include <map> | |
9 #include <string> | |
10 #include <utility> | |
11 | |
12 #include "base/base_export.h" | |
13 #include "base/memory/singleton.h" | |
14 #include "base/metrics/field_trial.h" | |
Alexei Svitkine (slow)
2016/10/28 15:39:17
Is this used in the header? If not, move to the cc
lawrencewu
2016/10/28 16:54:29
Done.
| |
15 #include "base/synchronization/lock.h" | |
16 | |
17 namespace base { | |
18 | |
19 // Keeps track of the parameters of all field trials and ensures access to them | |
20 // is thread-safe. | |
21 class BASE_EXPORT FieldTrialParamAssociator { | |
22 public: | |
23 typedef std::pair<std::string, std::string> | |
24 FieldTrialKey; // (FieldTrialName, FieldTrialGroup) | |
Alexei Svitkine (slow)
2016/10/28 15:39:17
Can this be in the private section?
lawrencewu
2016/10/28 16:54:29
Done.
| |
25 typedef std::map<std::string, std::string> FieldTrialParams; | |
26 | |
27 // Retrieve the singleton. | |
28 static FieldTrialParamAssociator* GetInstance(); | |
29 | |
30 bool AssociateFieldTrialParams(const std::string& trial_name, | |
31 const std::string& group_name, | |
32 const FieldTrialParams& params); | |
33 | |
34 bool GetFieldTrialParams(const std::string& trial_name, | |
35 FieldTrialParams* params); | |
36 | |
37 void ClearAllParamsForTesting(); | |
Alexei Svitkine (slow)
2016/10/28 15:39:17
Please add comments above all the public functions
lawrencewu
2016/10/28 16:54:29
Done.
| |
38 | |
39 private: | |
40 friend struct DefaultSingletonTraits<FieldTrialParamAssociator>; | |
41 | |
42 FieldTrialParamAssociator() {} | |
43 ~FieldTrialParamAssociator() {} | |
44 | |
45 Lock lock_; | |
46 std::map<FieldTrialKey, FieldTrialParams> field_trial_params_; | |
47 | |
48 DISALLOW_COPY_AND_ASSIGN(FieldTrialParamAssociator); | |
49 }; | |
50 | |
51 } // namespace base | |
52 | |
53 #endif // BASE_METRICS_FIELD_TRIAL_PARAM_ASSOCIATOR_H_ | |
OLD | NEW |