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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 // Class with a list of all active field trials. A trial is active if it has | 276 // Class with a list of all active field trials. A trial is active if it has |
277 // been registered, which includes evaluating its state based on its probaility. | 277 // been registered, which includes evaluating its state based on its probaility. |
278 // Only one instance of this class exists. | 278 // Only one instance of this class exists. |
279 class BASE_EXPORT FieldTrialList { | 279 class BASE_EXPORT FieldTrialList { |
280 public: | 280 public: |
281 // Define a separator character to use when creating a persistent form of an | 281 // Define a separator character to use when creating a persistent form of an |
282 // instance. This is intended for use as a command line argument, passed to a | 282 // instance. This is intended for use as a command line argument, passed to a |
283 // second process to mimic our state (i.e., provide the same group name). | 283 // second process to mimic our state (i.e., provide the same group name). |
284 static const char kPersistentStringSeparator; // Currently a slash. | 284 static const char kPersistentStringSeparator; // Currently a slash. |
285 | 285 |
286 // Define expiration year in future. It is initialized to two years from Now. | 286 // Year that is guaranteed to not be expired when instantiating a field trial |
287 static int kExpirationYearInFuture; | 287 // via |FactoryGetFieldTrial()|. Set to two years from the build date. |
| 288 static int kNoExpirationYear; |
288 | 289 |
289 // Observer is notified when a FieldTrial's group is selected. | 290 // Observer is notified when a FieldTrial's group is selected. |
290 class BASE_EXPORT Observer { | 291 class BASE_EXPORT Observer { |
291 public: | 292 public: |
292 // Notify observers when FieldTrials's group is selected. | 293 // Notify observers when FieldTrials's group is selected. |
293 virtual void OnFieldTrialGroupFinalized(const std::string& trial_name, | 294 virtual void OnFieldTrialGroupFinalized(const std::string& trial_name, |
294 const std::string& group_name) = 0; | 295 const std::string& group_name) = 0; |
295 | 296 |
296 protected: | 297 protected: |
297 virtual ~Observer(); | 298 virtual ~Observer(); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 | 436 |
436 // List of observers to be notified when a group is selected for a FieldTrial. | 437 // List of observers to be notified when a group is selected for a FieldTrial. |
437 scoped_refptr<ObserverListThreadSafe<Observer> > observer_list_; | 438 scoped_refptr<ObserverListThreadSafe<Observer> > observer_list_; |
438 | 439 |
439 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); | 440 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); |
440 }; | 441 }; |
441 | 442 |
442 } // namespace base | 443 } // namespace base |
443 | 444 |
444 #endif // BASE_METRICS_FIELD_TRIAL_H_ | 445 #endif // BASE_METRICS_FIELD_TRIAL_H_ |
OLD | NEW |