Chromium Code Reviews| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 | 51 |
| 52 //------------------------------------------------------------------------------ | 52 //------------------------------------------------------------------------------ |
| 53 | 53 |
| 54 #ifndef BASE_METRICS_FIELD_TRIAL_H_ | 54 #ifndef BASE_METRICS_FIELD_TRIAL_H_ |
| 55 #define BASE_METRICS_FIELD_TRIAL_H_ | 55 #define BASE_METRICS_FIELD_TRIAL_H_ |
| 56 | 56 |
| 57 #include <stddef.h> | 57 #include <stddef.h> |
| 58 #include <stdint.h> | 58 #include <stdint.h> |
| 59 | 59 |
| 60 #include <map> | 60 #include <map> |
| 61 #include <memory> | |
| 61 #include <set> | 62 #include <set> |
| 62 #include <string> | 63 #include <string> |
| 63 #include <vector> | 64 #include <vector> |
| 64 | 65 |
| 65 #include "base/base_export.h" | 66 #include "base/base_export.h" |
| 66 #include "base/gtest_prod_util.h" | 67 #include "base/gtest_prod_util.h" |
| 67 #include "base/macros.h" | 68 #include "base/macros.h" |
| 68 #include "base/memory/ref_counted.h" | 69 #include "base/memory/ref_counted.h" |
| 69 #include "base/observer_list_threadsafe.h" | 70 #include "base/observer_list_threadsafe.h" |
| 70 #include "base/strings/string_piece.h" | 71 #include "base/strings/string_piece.h" |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 331 // Notify observers when FieldTrials's group is selected. | 332 // Notify observers when FieldTrials's group is selected. |
| 332 virtual void OnFieldTrialGroupFinalized(const std::string& trial_name, | 333 virtual void OnFieldTrialGroupFinalized(const std::string& trial_name, |
| 333 const std::string& group_name) = 0; | 334 const std::string& group_name) = 0; |
| 334 | 335 |
| 335 protected: | 336 protected: |
| 336 virtual ~Observer(); | 337 virtual ~Observer(); |
| 337 }; | 338 }; |
| 338 | 339 |
| 339 // This singleton holds the global list of registered FieldTrials. | 340 // This singleton holds the global list of registered FieldTrials. |
| 340 // | 341 // |
| 341 // To support one-time randomized field trials, specify a non-NULL | 342 // To support one-time randomized field trials, specify a non-nullptr |
| 342 // |entropy_provider| which should be a source of uniformly distributed | 343 // |entropy_provider| which should be a source of uniformly distributed |
| 343 // entropy values. Takes ownership of |entropy_provider|. If one time | 344 // entropy values. If one time randomization is not desired, pass in nullptr |
|
Alexei Svitkine (slow)
2016/09/21 15:52:00
Nit: I think in comments just using "null" rather
robliao
2016/09/21 17:24:29
Change this to lowercase null then to deemphasize
| |
| 344 // randomization is not desired, pass in NULL for |entropy_provider|. | 345 // for |entropy_provider|. |
| 345 explicit FieldTrialList(const FieldTrial::EntropyProvider* entropy_provider); | 346 explicit FieldTrialList( |
| 347 std::unique_ptr<const FieldTrial::EntropyProvider> entropy_provider); | |
| 346 | 348 |
| 347 // Destructor Release()'s references to all registered FieldTrial instances. | 349 // Destructor Release()'s references to all registered FieldTrial instances. |
| 348 ~FieldTrialList(); | 350 ~FieldTrialList(); |
| 349 | 351 |
| 350 // Get a FieldTrial instance from the factory. | 352 // Get a FieldTrial instance from the factory. |
| 351 // | 353 // |
| 352 // |name| is used to register the instance with the FieldTrialList class, | 354 // |name| is used to register the instance with the FieldTrialList class, |
| 353 // and can be used to find the trial (only one trial can be present for each | 355 // and can be used to find the trial (only one trial can be present for each |
| 354 // name). |default_group_name| is the name of the default group which will | 356 // name). |default_group_name| is the name of the default group which will |
| 355 // be chosen if none of the subsequent appended groups get to be chosen. | 357 // be chosen if none of the subsequent appended groups get to be chosen. |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 522 | 524 |
| 523 // List of observers to be notified when a group is selected for a FieldTrial. | 525 // List of observers to be notified when a group is selected for a FieldTrial. |
| 524 scoped_refptr<ObserverListThreadSafe<Observer> > observer_list_; | 526 scoped_refptr<ObserverListThreadSafe<Observer> > observer_list_; |
| 525 | 527 |
| 526 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); | 528 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); |
| 527 }; | 529 }; |
| 528 | 530 |
| 529 } // namespace base | 531 } // namespace base |
| 530 | 532 |
| 531 #endif // BASE_METRICS_FIELD_TRIAL_H_ | 533 #endif // BASE_METRICS_FIELD_TRIAL_H_ |
| OLD | NEW |