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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 // | 340 // |
341 // To support one-time randomized field trials, specify a non-NULL | 341 // To support one-time randomized field trials, specify a non-NULL |
342 // |entropy_provider| which should be a source of uniformly distributed | 342 // |entropy_provider| which should be a source of uniformly distributed |
343 // entropy values. Takes ownership of |entropy_provider|. If one time | 343 // entropy values. Takes ownership of |entropy_provider|. If one time |
344 // randomization is not desired, pass in NULL for |entropy_provider|. | 344 // randomization is not desired, pass in NULL for |entropy_provider|. |
345 explicit FieldTrialList(const FieldTrial::EntropyProvider* entropy_provider); | 345 explicit FieldTrialList(const FieldTrial::EntropyProvider* entropy_provider); |
346 | 346 |
347 // Destructor Release()'s references to all registered FieldTrial instances. | 347 // Destructor Release()'s references to all registered FieldTrial instances. |
348 ~FieldTrialList(); | 348 ~FieldTrialList(); |
349 | 349 |
350 // TODO(asvitkine): Temporary function to diagnose http://crbug.com/359406. | |
351 // Remove when that bug is fixed. This enables using a global map that checks | |
352 // the state of field trials between possible FieldTrialList instances. If | |
353 // enabled, a CHECK will be hit if it's seen that a field trial is given a | |
354 // different state then what was specified to a renderer process launch | |
355 // command line. | |
356 static void EnableGlobalStateChecks(); | |
357 | |
358 // TODO(asvitkine): Temporary function to diagnose http://crbug.com/359406. | |
359 // Remove when that bug is fixed. This returns a unique token generated during | |
360 // FieldTrialList construction. This is used to verify that this value stays | |
361 // consistent between renderer process invocations. | |
362 static int32_t GetDebugToken(); | |
363 | |
364 // Get a FieldTrial instance from the factory. | 350 // Get a FieldTrial instance from the factory. |
365 // | 351 // |
366 // |name| is used to register the instance with the FieldTrialList class, | 352 // |name| is used to register the instance with the FieldTrialList class, |
367 // and can be used to find the trial (only one trial can be present for each | 353 // and can be used to find the trial (only one trial can be present for each |
368 // name). |default_group_name| is the name of the default group which will | 354 // name). |default_group_name| is the name of the default group which will |
369 // be chosen if none of the subsequent appended groups get to be chosen. | 355 // be chosen if none of the subsequent appended groups get to be chosen. |
370 // |default_group_number| can receive the group number of the default group as | 356 // |default_group_number| can receive the group number of the default group as |
371 // AppendGroup returns the number of the subsequence groups. |trial_name| and | 357 // AppendGroup returns the number of the subsequence groups. |trial_name| and |
372 // |default_group_name| may not be empty but |default_group_number| can be | 358 // |default_group_name| may not be empty but |default_group_number| can be |
373 // NULL if the value is not needed. | 359 // NULL if the value is not needed. |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 | 522 |
537 // List of observers to be notified when a group is selected for a FieldTrial. | 523 // List of observers to be notified when a group is selected for a FieldTrial. |
538 scoped_refptr<ObserverListThreadSafe<Observer> > observer_list_; | 524 scoped_refptr<ObserverListThreadSafe<Observer> > observer_list_; |
539 | 525 |
540 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); | 526 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); |
541 }; | 527 }; |
542 | 528 |
543 } // namespace base | 529 } // namespace base |
544 | 530 |
545 #endif // BASE_METRICS_FIELD_TRIAL_H_ | 531 #endif // BASE_METRICS_FIELD_TRIAL_H_ |
OLD | NEW |