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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // SetPruningAlgorithm(kType1); // Sample setting of browser state. | 48 // SetPruningAlgorithm(kType1); // Sample setting of browser state. |
49 // else if (trial->group() == low_mem_group) | 49 // else if (trial->group() == low_mem_group) |
50 // SetPruningAlgorithm(kType2); // Sample alternate setting. | 50 // SetPruningAlgorithm(kType2); // Sample alternate setting. |
51 | 51 |
52 //------------------------------------------------------------------------------ | 52 //------------------------------------------------------------------------------ |
53 | 53 |
54 #ifndef BASE_METRICS_FIELD_TRIAL_H_ | 54 #ifndef BASE_METRICS_FIELD_TRIAL_H_ |
55 #define BASE_METRICS_FIELD_TRIAL_H_ | 55 #define BASE_METRICS_FIELD_TRIAL_H_ |
56 | 56 |
57 #include <map> | 57 #include <map> |
| 58 #include <set> |
58 #include <string> | 59 #include <string> |
59 #include <vector> | 60 #include <vector> |
60 | 61 |
61 #include "base/base_export.h" | 62 #include "base/base_export.h" |
62 #include "base/gtest_prod_util.h" | 63 #include "base/gtest_prod_util.h" |
63 #include "base/memory/ref_counted.h" | 64 #include "base/memory/ref_counted.h" |
64 #include "base/observer_list_threadsafe.h" | 65 #include "base/observer_list_threadsafe.h" |
65 #include "base/synchronization/lock.h" | 66 #include "base/synchronization/lock.h" |
66 #include "base/time/time.h" | 67 #include "base/time/time.h" |
67 | 68 |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 static void GetActiveFieldTrialGroups( | 406 static void GetActiveFieldTrialGroups( |
406 FieldTrial::ActiveGroups* active_groups); | 407 FieldTrial::ActiveGroups* active_groups); |
407 | 408 |
408 // Use a state string (re: StatesToString()) to augment the current list of | 409 // Use a state string (re: StatesToString()) to augment the current list of |
409 // field trials to include the supplied trials, and using a 100% probability | 410 // field trials to include the supplied trials, and using a 100% probability |
410 // for each trial, force them to have the same group string. This is commonly | 411 // for each trial, force them to have the same group string. This is commonly |
411 // used in a non-browser process, to carry randomly selected state in a | 412 // used in a non-browser process, to carry randomly selected state in a |
412 // browser process into this non-browser process, but could also be invoked | 413 // browser process into this non-browser process, but could also be invoked |
413 // through a command line argument to the browser process. The created field | 414 // through a command line argument to the browser process. The created field |
414 // trials are marked as "used" for the purposes of active trial reporting if | 415 // trials are marked as "used" for the purposes of active trial reporting if |
415 // |mode| is ACTIVATE_TRIALS. | 416 // |mode| is ACTIVATE_TRIALS. Trial names in |ignored_trial_names| are ignored |
416 static bool CreateTrialsFromString(const std::string& prior_trials, | 417 // when parsing |prior_trials|. |
417 FieldTrialActivationMode mode); | 418 static bool CreateTrialsFromString( |
| 419 const std::string& prior_trials, |
| 420 FieldTrialActivationMode mode, |
| 421 const std::set<std::string>& ignored_trial_names); |
418 | 422 |
419 // Create a FieldTrial with the given |name| and using 100% probability for | 423 // Create a FieldTrial with the given |name| and using 100% probability for |
420 // the FieldTrial, force FieldTrial to have the same group string as | 424 // the FieldTrial, force FieldTrial to have the same group string as |
421 // |group_name|. This is commonly used in a non-browser process, to carry | 425 // |group_name|. This is commonly used in a non-browser process, to carry |
422 // randomly selected state in a browser process into this non-browser process. | 426 // randomly selected state in a browser process into this non-browser process. |
423 // It returns NULL if there is a FieldTrial that is already registered with | 427 // It returns NULL if there is a FieldTrial that is already registered with |
424 // the same |name| but has different finalized group string (|group_name|). | 428 // the same |name| but has different finalized group string (|group_name|). |
425 static FieldTrial* CreateFieldTrial(const std::string& name, | 429 static FieldTrial* CreateFieldTrial(const std::string& name, |
426 const std::string& group_name); | 430 const std::string& group_name); |
427 | 431 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 | 478 |
475 // List of observers to be notified when a group is selected for a FieldTrial. | 479 // List of observers to be notified when a group is selected for a FieldTrial. |
476 scoped_refptr<ObserverListThreadSafe<Observer> > observer_list_; | 480 scoped_refptr<ObserverListThreadSafe<Observer> > observer_list_; |
477 | 481 |
478 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); | 482 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); |
479 }; | 483 }; |
480 | 484 |
481 } // namespace base | 485 } // namespace base |
482 | 486 |
483 #endif // BASE_METRICS_FIELD_TRIAL_H_ | 487 #endif // BASE_METRICS_FIELD_TRIAL_H_ |
OLD | NEW |