OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef COMPONENTS_VARIATIONS_VARIATIONS_ASSOCIATED_DATA_H_ | 5 #ifndef COMPONENTS_VARIATIONS_VARIATIONS_ASSOCIATED_DATA_H_ |
6 #define COMPONENTS_VARIATIONS_VARIATIONS_ASSOCIATED_DATA_H_ | 6 #define COMPONENTS_VARIATIONS_VARIATIONS_ASSOCIATED_DATA_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
106 const ActiveGroupId& active_group); | 106 const ActiveGroupId& active_group); |
107 | 107 |
108 // Associates the specified set of key-value |params| with the variation | 108 // Associates the specified set of key-value |params| with the variation |
109 // specified by |trial_name| and |group_name|. Fails and returns false if the | 109 // specified by |trial_name| and |group_name|. Fails and returns false if the |
110 // specified variation already has params associated with it or the field trial | 110 // specified variation already has params associated with it or the field trial |
111 // is already active (group() has been called on it). Thread safe. | 111 // is already active (group() has been called on it). Thread safe. |
112 bool AssociateVariationParams(const std::string& trial_name, | 112 bool AssociateVariationParams(const std::string& trial_name, |
113 const std::string& group_name, | 113 const std::string& group_name, |
114 const std::map<std::string, std::string>& params); | 114 const std::map<std::string, std::string>& params); |
115 | 115 |
116 // Provide a mechanism to associate multiple set of params to multiple groups | |
Alexei Svitkine (slow)
2015/04/29 15:34:25
Nit: Provide -> Provides
danduong
2015/04/29 21:00:09
Done.
| |
117 // with a formatted string specified from commandline. For example: | |
118 // "trial1.group1:k1/v1/k2/v2,trial2.group2:k1/v1" defines parameters for two | |
119 // variations. One of which is identified with trial name "trial1" and group | |
120 // name "group1". This variation also has two key/value pairs associated in the | |
121 // paramenters (k1,v1 and k2,v2). | |
Alexei Svitkine (slow)
2015/04/29 15:34:25
Mention something about the escape format.
You co
danduong
2015/04/29 21:00:09
Done.
| |
122 bool AssociateParamsFromString(const std::string& variations_string); | |
123 | |
116 // Retrieves the set of key-value |params| for the variation associated with | 124 // Retrieves the set of key-value |params| for the variation associated with |
117 // the specified field trial, based on its selected group. If the field trial | 125 // the specified field trial, based on its selected group. If the field trial |
118 // does not exist or its selected group does not have any parameters associated | 126 // does not exist or its selected group does not have any parameters associated |
119 // with it, returns false and does not modify |params|. Calling this function | 127 // with it, returns false and does not modify |params|. Calling this function |
120 // will result in the field trial being marked as active if found (i.e. group() | 128 // will result in the field trial being marked as active if found (i.e. group() |
121 // will be called on it), if it wasn't already. Currently, this information is | 129 // will be called on it), if it wasn't already. Currently, this information is |
122 // only available from the browser process. Thread safe. | 130 // only available from the browser process. Thread safe. |
123 bool GetVariationParams(const std::string& trial_name, | 131 bool GetVariationParams(const std::string& trial_name, |
124 std::map<std::string, std::string>* params); | 132 std::map<std::string, std::string>* params); |
125 | 133 |
(...skipping 14 matching lines...) Expand all Loading... | |
140 void ClearAllVariationIDs(); | 148 void ClearAllVariationIDs(); |
141 | 149 |
142 // Clears all of the associated params. | 150 // Clears all of the associated params. |
143 void ClearAllVariationParams(); | 151 void ClearAllVariationParams(); |
144 | 152 |
145 } // namespace testing | 153 } // namespace testing |
146 | 154 |
147 } // namespace variations | 155 } // namespace variations |
148 | 156 |
149 #endif // COMPONENTS_VARIATIONS_VARIATIONS_ASSOCIATED_DATA_H_ | 157 #endif // COMPONENTS_VARIATIONS_VARIATIONS_ASSOCIATED_DATA_H_ |
OLD | NEW |