| OLD | NEW |
| 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 #ifndef COMPONENTS_VARIATIONS_ACTIVE_FIELD_TRIALS_H_ | 5 #ifndef COMPONENTS_VARIATIONS_ACTIVE_FIELD_TRIALS_H_ |
| 6 #define COMPONENTS_VARIATIONS_ACTIVE_FIELD_TRIALS_H_ | 6 #define COMPONENTS_VARIATIONS_ACTIVE_FIELD_TRIALS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include <string> | 10 #include <string> |
| 9 | 11 |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
| 12 | 13 |
| 13 namespace variations { | 14 namespace variations { |
| 14 | 15 |
| 15 // The Unique ID of a trial and its active group, where the name and group | 16 // The Unique ID of a trial and its active group, where the name and group |
| 16 // identifiers are hashes of the trial and group name strings. | 17 // identifiers are hashes of the trial and group name strings. |
| 17 struct ActiveGroupId { | 18 struct ActiveGroupId { |
| 18 uint32 name; | 19 uint32_t name; |
| 19 uint32 group; | 20 uint32_t group; |
| 20 }; | 21 }; |
| 21 | 22 |
| 22 // Returns an ActiveGroupId struct for the given trial and group names. | 23 // Returns an ActiveGroupId struct for the given trial and group names. |
| 23 ActiveGroupId MakeActiveGroupId(const std::string& trial_name, | 24 ActiveGroupId MakeActiveGroupId(const std::string& trial_name, |
| 24 const std::string& group_name); | 25 const std::string& group_name); |
| 25 | 26 |
| 26 // We need to supply a Compare class for templates since ActiveGroupId is a | 27 // We need to supply a Compare class for templates since ActiveGroupId is a |
| 27 // user-defined type. | 28 // user-defined type. |
| 28 struct ActiveGroupIdCompare { | 29 struct ActiveGroupIdCompare { |
| 29 bool operator() (const ActiveGroupId& lhs, const ActiveGroupId& rhs) const { | 30 bool operator() (const ActiveGroupId& lhs, const ActiveGroupId& rhs) const { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 55 | 56 |
| 56 void TestGetFieldTrialActiveGroupIds( | 57 void TestGetFieldTrialActiveGroupIds( |
| 57 const base::FieldTrial::ActiveGroups& active_groups, | 58 const base::FieldTrial::ActiveGroups& active_groups, |
| 58 std::vector<ActiveGroupId>* name_group_ids); | 59 std::vector<ActiveGroupId>* name_group_ids); |
| 59 | 60 |
| 60 } // namespace testing | 61 } // namespace testing |
| 61 | 62 |
| 62 } // namespace variations | 63 } // namespace variations |
| 63 | 64 |
| 64 #endif // COMPONENTS_VARIATIONS_ACTIVE_FIELD_TRIALS_H_ | 65 #endif // COMPONENTS_VARIATIONS_ACTIVE_FIELD_TRIALS_H_ |
| OLD | NEW |