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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 StringPiece group_name; | 130 StringPiece group_name; |
131 bool activated; | 131 bool activated; |
132 | 132 |
133 State(); | 133 State(); |
134 State(const State& other); | 134 State(const State& other); |
135 ~State(); | 135 ~State(); |
136 }; | 136 }; |
137 | 137 |
138 // We create one FieldTrialEntry per field trial in shared memory, via | 138 // We create one FieldTrialEntry per field trial in shared memory, via |
139 // AddToAllocatorWhileLocked. The FieldTrialEntry is followed by a | 139 // AddToAllocatorWhileLocked. The FieldTrialEntry is followed by a |
140 // base::Pickle object that we unpickle and read from. Any changes to this | 140 // base::Pickle object that we unpickle and read from. |
141 // structure requires a bump in kFieldTrialType id defined in the .cc file. | |
142 struct BASE_EXPORT FieldTrialEntry { | 141 struct BASE_EXPORT FieldTrialEntry { |
| 142 // SHA1(FieldTrialEntry): Increment this if structure changes! |
| 143 static constexpr uint32_t kPersistentTypeId = 0xABA17E13 + 2; |
| 144 |
143 // Expected size for 32/64-bit check. | 145 // Expected size for 32/64-bit check. |
144 static constexpr size_t kExpectedInstanceSize = 8; | 146 static constexpr size_t kExpectedInstanceSize = 8; |
145 | 147 |
146 // Whether or not this field trial is activated. This is really just a | 148 // Whether or not this field trial is activated. This is really just a |
147 // boolean but using a 32 bit value for portability reasons. It should be | 149 // boolean but using a 32 bit value for portability reasons. It should be |
148 // accessed via NoBarrier_Load()/NoBarrier_Store() to prevent the compiler | 150 // accessed via NoBarrier_Load()/NoBarrier_Store() to prevent the compiler |
149 // from doing unexpected optimizations because it thinks that only one | 151 // from doing unexpected optimizations because it thinks that only one |
150 // thread is accessing the memory location. | 152 // thread is accessing the memory location. |
151 subtle::Atomic32 activated; | 153 subtle::Atomic32 activated; |
152 | 154 |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 | 731 |
730 // Tracks whether CreateTrialsFromCommandLine() has been called. | 732 // Tracks whether CreateTrialsFromCommandLine() has been called. |
731 bool create_trials_from_command_line_called_ = false; | 733 bool create_trials_from_command_line_called_ = false; |
732 | 734 |
733 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); | 735 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); |
734 }; | 736 }; |
735 | 737 |
736 } // namespace base | 738 } // namespace base |
737 | 739 |
738 #endif // BASE_METRICS_FIELD_TRIAL_H_ | 740 #endif // BASE_METRICS_FIELD_TRIAL_H_ |
OLD | NEW |