| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 //------------------------------------------------------------------------------ | 72 //------------------------------------------------------------------------------ |
| 73 | 73 |
| 74 #ifndef BASE_METRICS_FIELD_TRIAL_H_ | 74 #ifndef BASE_METRICS_FIELD_TRIAL_H_ |
| 75 #define BASE_METRICS_FIELD_TRIAL_H_ | 75 #define BASE_METRICS_FIELD_TRIAL_H_ |
| 76 #pragma once | 76 #pragma once |
| 77 | 77 |
| 78 #include <map> | 78 #include <map> |
| 79 #include <string> | 79 #include <string> |
| 80 | 80 |
| 81 #include "base/base_api.h" | 81 #include "base/base_export.h" |
| 82 #include "base/gtest_prod_util.h" | 82 #include "base/gtest_prod_util.h" |
| 83 #include "base/memory/ref_counted.h" | 83 #include "base/memory/ref_counted.h" |
| 84 #include "base/observer_list.h" | 84 #include "base/observer_list.h" |
| 85 #include "base/synchronization/lock.h" | 85 #include "base/synchronization/lock.h" |
| 86 #include "base/time.h" | 86 #include "base/time.h" |
| 87 | 87 |
| 88 namespace base { | 88 namespace base { |
| 89 | 89 |
| 90 class FieldTrialList; | 90 class FieldTrialList; |
| 91 | 91 |
| 92 class BASE_API FieldTrial : public RefCounted<FieldTrial> { | 92 class BASE_EXPORT FieldTrial : public RefCounted<FieldTrial> { |
| 93 public: | 93 public: |
| 94 typedef int Probability; // Probability type for being selected in a trial. | 94 typedef int Probability; // Probability type for being selected in a trial. |
| 95 | 95 |
| 96 // A return value to indicate that a given instance has not yet had a group | 96 // A return value to indicate that a given instance has not yet had a group |
| 97 // assignment (and hence is not yet participating in the trial). | 97 // assignment (and hence is not yet participating in the trial). |
| 98 static const int kNotFinalized; | 98 static const int kNotFinalized; |
| 99 | 99 |
| 100 // This is the group number of the 'default' group. This provides an easy way | 100 // This is the group number of the 'default' group. This provides an easy way |
| 101 // to assign all the remaining probability to a group ('default'). | 101 // to assign all the remaining probability to a group ('default'). |
| 102 static const int kDefaultGroupNumber; | 102 static const int kDefaultGroupNumber; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 // group. | 232 // group. |
| 233 static bool enable_benchmarking_; | 233 static bool enable_benchmarking_; |
| 234 | 234 |
| 235 DISALLOW_COPY_AND_ASSIGN(FieldTrial); | 235 DISALLOW_COPY_AND_ASSIGN(FieldTrial); |
| 236 }; | 236 }; |
| 237 | 237 |
| 238 //------------------------------------------------------------------------------ | 238 //------------------------------------------------------------------------------ |
| 239 // Class with a list of all active field trials. A trial is active if it has | 239 // Class with a list of all active field trials. A trial is active if it has |
| 240 // been registered, which includes evaluating its state based on its probaility. | 240 // been registered, which includes evaluating its state based on its probaility. |
| 241 // Only one instance of this class exists. | 241 // Only one instance of this class exists. |
| 242 class BASE_API FieldTrialList { | 242 class BASE_EXPORT FieldTrialList { |
| 243 public: | 243 public: |
| 244 // Define a separator charactor to use when creating a persistent form of an | 244 // Define a separator charactor to use when creating a persistent form of an |
| 245 // instance. This is intended for use as a command line argument, passed to a | 245 // instance. This is intended for use as a command line argument, passed to a |
| 246 // second process to mimic our state (i.e., provide the same group name). | 246 // second process to mimic our state (i.e., provide the same group name). |
| 247 static const char kPersistentStringSeparator; // Currently a slash. | 247 static const char kPersistentStringSeparator; // Currently a slash. |
| 248 | 248 |
| 249 // Define expiration year in future. It is initialized to two years from Now. | 249 // Define expiration year in future. It is initialized to two years from Now. |
| 250 static int kExpirationYearInFuture; | 250 static int kExpirationYearInFuture; |
| 251 | 251 |
| 252 // Observer is notified when a FieldTrial's group is selected. | 252 // Observer is notified when a FieldTrial's group is selected. |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 | 385 |
| 386 // List of observers to be notified when a group is selected for a FieldTrial. | 386 // List of observers to be notified when a group is selected for a FieldTrial. |
| 387 ObserverList<Observer> observer_list_; | 387 ObserverList<Observer> observer_list_; |
| 388 | 388 |
| 389 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); | 389 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); |
| 390 }; | 390 }; |
| 391 | 391 |
| 392 } // namespace base | 392 } // namespace base |
| 393 | 393 |
| 394 #endif // BASE_METRICS_FIELD_TRIAL_H_ | 394 #endif // BASE_METRICS_FIELD_TRIAL_H_ |
| OLD | NEW |