| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 //------------------------------------------------------------------------------ | 60 //------------------------------------------------------------------------------ |
| 61 | 61 |
| 62 #ifndef BASE_METRICS_FIELD_TRIAL_H_ | 62 #ifndef BASE_METRICS_FIELD_TRIAL_H_ |
| 63 #define BASE_METRICS_FIELD_TRIAL_H_ | 63 #define BASE_METRICS_FIELD_TRIAL_H_ |
| 64 #pragma once | 64 #pragma once |
| 65 | 65 |
| 66 #include <map> | 66 #include <map> |
| 67 #include <string> | 67 #include <string> |
| 68 | 68 |
| 69 #include "base/lock.h" | |
| 70 #include "base/ref_counted.h" | 69 #include "base/ref_counted.h" |
| 70 #include "base/synchronization/lock.h" |
| 71 #include "base/time.h" | 71 #include "base/time.h" |
| 72 | 72 |
| 73 namespace base { | 73 namespace base { |
| 74 | 74 |
| 75 class FieldTrial : public RefCounted<FieldTrial> { | 75 class FieldTrial : public RefCounted<FieldTrial> { |
| 76 public: | 76 public: |
| 77 typedef int Probability; // Probability type for being selected in a trial. | 77 typedef int Probability; // Probability type for being selected in a trial. |
| 78 | 78 |
| 79 // A return value to indicate that a given instance has not yet had a group | 79 // A return value to indicate that a given instance has not yet had a group |
| 80 // assignment (and hence is not yet participating in the trial). | 80 // assignment (and hence is not yet participating in the trial). |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 // creating the FieldTrialList. This is not an error, unless a FieldTrialList | 229 // creating the FieldTrialList. This is not an error, unless a FieldTrialList |
| 230 // is created after that. | 230 // is created after that. |
| 231 static bool register_without_global_; | 231 static bool register_without_global_; |
| 232 | 232 |
| 233 // A helper value made availabel to users, that shows when the FieldTrialList | 233 // A helper value made availabel to users, that shows when the FieldTrialList |
| 234 // was initialized. Note that this is a singleton instance, and hence is a | 234 // was initialized. Note that this is a singleton instance, and hence is a |
| 235 // good approximation to the start of the process. | 235 // good approximation to the start of the process. |
| 236 TimeTicks application_start_time_; | 236 TimeTicks application_start_time_; |
| 237 | 237 |
| 238 // Lock for access to registered_. | 238 // Lock for access to registered_. |
| 239 Lock lock_; | 239 base::Lock lock_; |
| 240 RegistrationList registered_; | 240 RegistrationList registered_; |
| 241 | 241 |
| 242 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); | 242 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); |
| 243 }; | 243 }; |
| 244 | 244 |
| 245 } // namespace base | 245 } // namespace base |
| 246 | 246 |
| 247 #endif // BASE_METRICS_FIELD_TRIAL_H_ | 247 #endif // BASE_METRICS_FIELD_TRIAL_H_ |
| 248 | 248 |
| OLD | NEW |