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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 | 357 |
358 private: | 358 private: |
359 // A map from FieldTrial names to the actual instances. | 359 // A map from FieldTrial names to the actual instances. |
360 typedef std::map<std::string, FieldTrial*> RegistrationList; | 360 typedef std::map<std::string, FieldTrial*> RegistrationList; |
361 | 361 |
362 // Helper function should be called only while holding lock_. | 362 // Helper function should be called only while holding lock_. |
363 FieldTrial* PreLockedFind(const std::string& name); | 363 FieldTrial* PreLockedFind(const std::string& name); |
364 | 364 |
365 static FieldTrialList* global_; // The singleton of this class. | 365 static FieldTrialList* global_; // The singleton of this class. |
366 | 366 |
367 // This will tell us if there is an attempt to register a field trial without | 367 // This will tell us if there is an attempt to register a field |
368 // creating the FieldTrialList. This is not an error, unless a FieldTrialList | 368 // trial or check if one-time randomization is enabled without |
369 // is created after that. | 369 // creating the FieldTrialList. This is not an error, unless a |
370 static bool register_without_global_; | 370 // FieldTrialList is created after that. |
| 371 static bool used_without_global_; |
371 | 372 |
372 // A helper value made available to users, that shows when the FieldTrialList | 373 // A helper value made available to users, that shows when the FieldTrialList |
373 // was initialized. Note that this is a singleton instance, and hence is a | 374 // was initialized. Note that this is a singleton instance, and hence is a |
374 // good approximation to the start of the process. | 375 // good approximation to the start of the process. |
375 TimeTicks application_start_time_; | 376 TimeTicks application_start_time_; |
376 | 377 |
377 // Lock for access to registered_. | 378 // Lock for access to registered_. |
378 base::Lock lock_; | 379 base::Lock lock_; |
379 RegistrationList registered_; | 380 RegistrationList registered_; |
380 | 381 |
381 // An opaque, diverse ID for this client that does not change | 382 // An opaque, diverse ID for this client that does not change |
382 // between sessions, or the empty string if not initialized. | 383 // between sessions, or the empty string if not initialized. |
383 std::string client_id_; | 384 std::string client_id_; |
384 | 385 |
385 // List of observers to be notified when a group is selected for a FieldTrial. | 386 // List of observers to be notified when a group is selected for a FieldTrial. |
386 ObserverList<Observer> observer_list_; | 387 ObserverList<Observer> observer_list_; |
387 | 388 |
388 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); | 389 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); |
389 }; | 390 }; |
390 | 391 |
391 } // namespace base | 392 } // namespace base |
392 | 393 |
393 #endif // BASE_METRICS_FIELD_TRIAL_H_ | 394 #endif // BASE_METRICS_FIELD_TRIAL_H_ |
OLD | NEW |