| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 #include "base/time/time.h" | 77 #include "base/time/time.h" |
| 78 | 78 |
| 79 namespace base { | 79 namespace base { |
| 80 | 80 |
| 81 class FieldTrialList; | 81 class FieldTrialList; |
| 82 | 82 |
| 83 class BASE_EXPORT FieldTrial : public RefCounted<FieldTrial> { | 83 class BASE_EXPORT FieldTrial : public RefCounted<FieldTrial> { |
| 84 public: | 84 public: |
| 85 typedef int Probability; // Probability type for being selected in a trial. | 85 typedef int Probability; // Probability type for being selected in a trial. |
| 86 | 86 |
| 87 // TODO(665129): Make private again after crash has been resolved. |
| 88 typedef SharedPersistentMemoryAllocator::Reference FieldTrialRef; |
| 89 |
| 87 // Specifies the persistence of the field trial group choice. | 90 // Specifies the persistence of the field trial group choice. |
| 88 enum RandomizationType { | 91 enum RandomizationType { |
| 89 // One time randomized trials will persist the group choice between | 92 // One time randomized trials will persist the group choice between |
| 90 // restarts, which is recommended for most trials, especially those that | 93 // restarts, which is recommended for most trials, especially those that |
| 91 // change user visible behavior. | 94 // change user visible behavior. |
| 92 ONE_TIME_RANDOMIZED, | 95 ONE_TIME_RANDOMIZED, |
| 93 // Session randomized trials will roll the dice to select a group on every | 96 // Session randomized trials will roll the dice to select a group on every |
| 94 // process restart. | 97 // process restart. |
| 95 SESSION_RANDOMIZED, | 98 SESSION_RANDOMIZED, |
| 96 }; | 99 }; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, Save); | 215 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, Save); |
| 213 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, SaveAll); | 216 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, SaveAll); |
| 214 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, DuplicateRestore); | 217 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, DuplicateRestore); |
| 215 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, SetForcedTurnFeatureOff); | 218 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, SetForcedTurnFeatureOff); |
| 216 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, SetForcedTurnFeatureOn); | 219 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, SetForcedTurnFeatureOn); |
| 217 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, SetForcedChangeDefault_Default); | 220 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, SetForcedChangeDefault_Default); |
| 218 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, SetForcedChangeDefault_NonDefault); | 221 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, SetForcedChangeDefault_NonDefault); |
| 219 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, FloatBoundariesGiveEqualGroupSizes); | 222 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, FloatBoundariesGiveEqualGroupSizes); |
| 220 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, DoesNotSurpassTotalProbability); | 223 FRIEND_TEST_ALL_PREFIXES(FieldTrialTest, DoesNotSurpassTotalProbability); |
| 221 | 224 |
| 222 typedef SharedPersistentMemoryAllocator::Reference FieldTrialRef; | |
| 223 | |
| 224 friend class base::FieldTrialList; | 225 friend class base::FieldTrialList; |
| 225 | 226 |
| 226 friend class RefCounted<FieldTrial>; | 227 friend class RefCounted<FieldTrial>; |
| 227 | 228 |
| 228 // This is the group number of the 'default' group when a choice wasn't forced | 229 // This is the group number of the 'default' group when a choice wasn't forced |
| 229 // by a call to FieldTrialList::CreateFieldTrial. It is kept private so that | 230 // by a call to FieldTrialList::CreateFieldTrial. It is kept private so that |
| 230 // consumers don't use it by mistake in cases where the group was forced. | 231 // consumers don't use it by mistake in cases where the group was forced. |
| 231 static const int kDefaultGroupNumber; | 232 static const int kDefaultGroupNumber; |
| 232 | 233 |
| 233 // Creates a field trial with the specified parameters. Group assignment will | 234 // Creates a field trial with the specified parameters. Group assignment will |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 // AppendFieldTrialHandleIfNeeded(). | 621 // AppendFieldTrialHandleIfNeeded(). |
| 621 HANDLE readonly_allocator_handle_ = nullptr; | 622 HANDLE readonly_allocator_handle_ = nullptr; |
| 622 #endif | 623 #endif |
| 623 | 624 |
| 624 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); | 625 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); |
| 625 }; | 626 }; |
| 626 | 627 |
| 627 } // namespace base | 628 } // namespace base |
| 628 | 629 |
| 629 #endif // BASE_METRICS_FIELD_TRIAL_H_ | 630 #endif // BASE_METRICS_FIELD_TRIAL_H_ |
| OLD | NEW |