| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // FieldTrial is a class for handling details of statistical experiments | 5 // FieldTrial is a class for handling details of statistical experiments |
| 6 // performed by actual users in the field (i.e., in a shipped or beta product). | 6 // performed by actual users in the field (i.e., in a shipped or beta product). |
| 7 // All code is called exclusively on the UI thread currently. | 7 // All code is called exclusively on the UI thread currently. |
| 8 // | 8 // |
| 9 // The simplest example is an experiment to see whether one of two options | 9 // The simplest example is an experiment to see whether one of two options |
| 10 // produces "better" results across our user population. In that scenario, UMA | 10 // produces "better" results across our user population. In that scenario, UMA |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 bool GetSelectedGroup(SelectedGroup* selected_group); | 145 bool GetSelectedGroup(SelectedGroup* selected_group); |
| 146 | 146 |
| 147 // Helper function for the most common use: as an argument to specify the | 147 // Helper function for the most common use: as an argument to specify the |
| 148 // name of a HISTOGRAM. Use the original histogram name as the name_prefix. | 148 // name of a HISTOGRAM. Use the original histogram name as the name_prefix. |
| 149 static std::string MakeName(const std::string& name_prefix, | 149 static std::string MakeName(const std::string& name_prefix, |
| 150 const std::string& trial_name); | 150 const std::string& trial_name); |
| 151 | 151 |
| 152 // Enable benchmarking sets field trials to a common setting. | 152 // Enable benchmarking sets field trials to a common setting. |
| 153 static void EnableBenchmarking(); | 153 static void EnableBenchmarking(); |
| 154 | 154 |
| 155 // Set the field trial as forced, meaning that it was setup earlier than |
| 156 // the hard coded registration of the field trial to override it. |
| 157 // This allows the code that was hard coded to register the field trial to |
| 158 // still succeed even though the field trial has already been registered. |
| 159 // This must be called after appending all the groups, since we will make |
| 160 // the group choice here. Note that this is a NOOP for already forced trials. |
| 161 // And, as the rest of the FieldTrial code, this is not thread safe and must |
| 162 // be done from the UI thread. |
| 163 void SetForced(); |
| 164 |
| 155 private: | 165 private: |
| 156 // Allow tests to access our innards for testing purposes. | 166 // Allow tests to access our innards for testing purposes. |
| 157 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, Registration); | 167 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, Registration); |
| 158 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, AbsoluteProbabilities); | 168 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, AbsoluteProbabilities); |
| 159 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, RemainingProbability); | 169 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, RemainingProbability); |
| 160 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, FiftyFiftyProbability); | 170 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, FiftyFiftyProbability); |
| 161 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, MiddleProbabilities); | 171 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, MiddleProbabilities); |
| 162 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, OneWinner); | 172 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, OneWinner); |
| 163 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, DisableProbability); | 173 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, DisableProbability); |
| 164 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, Save); | 174 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, Save); |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 | 434 |
| 425 // List of observers to be notified when a group is selected for a FieldTrial. | 435 // List of observers to be notified when a group is selected for a FieldTrial. |
| 426 scoped_refptr<ObserverListThreadSafe<Observer> > observer_list_; | 436 scoped_refptr<ObserverListThreadSafe<Observer> > observer_list_; |
| 427 | 437 |
| 428 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); | 438 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); |
| 429 }; | 439 }; |
| 430 | 440 |
| 431 } // namespace base | 441 } // namespace base |
| 432 | 442 |
| 433 #endif // BASE_METRICS_FIELD_TRIAL_H_ | 443 #endif // BASE_METRICS_FIELD_TRIAL_H_ |
| OLD | NEW |