OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 a test to see whether one of two options produces | 9 // The simplest example is a test to see whether one of two options produces |
10 // "better" results across our user population. In that scenario, UMA data | 10 // "better" results across our user population. In that scenario, UMA data |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 // The Find() method can be used to test to see if a named Trial was already | 64 // The Find() method can be used to test to see if a named Trial was already |
65 // registered, or to retrieve a pointer to it from the global map. | 65 // registered, or to retrieve a pointer to it from the global map. |
66 static FieldTrial* Find(const std::wstring& name); | 66 static FieldTrial* Find(const std::wstring& name); |
67 | 67 |
68 // The time of construction of the global map is recorded in a static variable | 68 // The time of construction of the global map is recorded in a static variable |
69 // and is commonly used by experiments to identify the time since the start | 69 // and is commonly used by experiments to identify the time since the start |
70 // of the application. In some experiments it may be useful to discount | 70 // of the application. In some experiments it may be useful to discount |
71 // data that is gathered before the application has reach sufficient | 71 // data that is gathered before the application has reach sufficient |
72 // stability (example: most DLL have loaded, etc.) | 72 // stability (example: most DLL have loaded, etc.) |
73 static Time application_start_time() { | 73 static base::Time application_start_time() { |
74 return global_->application_start_time_; | 74 return global_->application_start_time_; |
75 } | 75 } |
76 | 76 |
77 private: | 77 private: |
78 typedef std::map<std::wstring, FieldTrial*> RegistrationList; | 78 typedef std::map<std::wstring, FieldTrial*> RegistrationList; |
79 | 79 |
80 friend class FieldTrialTest; | 80 friend class FieldTrialTest; |
81 static void ResetConstructorCountForTestingOnly() { constructor_count_ = 0; } | 81 static void ResetConstructorCountForTestingOnly() { constructor_count_ = 0; } |
82 | 82 |
83 static FieldTrialList* global_; // The singleton of this class. | 83 static FieldTrialList* global_; // The singleton of this class. |
84 static int constructor_count_; // Prevent having more than one. | 84 static int constructor_count_; // Prevent having more than one. |
85 | 85 |
86 Time application_start_time_; | 86 base::Time application_start_time_; |
87 RegistrationList registered_; | 87 RegistrationList registered_; |
88 | 88 |
89 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); | 89 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); |
90 }; | 90 }; |
91 | 91 |
92 #endif // BASE_FIELD_TRIAL_H_ | 92 #endif // BASE_FIELD_TRIAL_H_ |
OLD | NEW |