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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 // has been chosen and externally observed (via |group()|) and which have | 463 // has been chosen and externally observed (via |group()|) and which have |
464 // not been disabled. | 464 // not been disabled. |
465 static void GetActiveFieldTrialGroups( | 465 static void GetActiveFieldTrialGroups( |
466 FieldTrial::ActiveGroups* active_groups); | 466 FieldTrial::ActiveGroups* active_groups); |
467 | 467 |
468 // Returns the field trials that are marked active in |trials_string|. | 468 // Returns the field trials that are marked active in |trials_string|. |
469 static void GetActiveFieldTrialGroupsFromString( | 469 static void GetActiveFieldTrialGroupsFromString( |
470 const std::string& trials_string, | 470 const std::string& trials_string, |
471 FieldTrial::ActiveGroups* active_groups); | 471 FieldTrial::ActiveGroups* active_groups); |
472 | 472 |
| 473 // Returns the field trials that were active when the process was |
| 474 // created. Either parses the field trial string or the shared memory |
| 475 // holding field trial information. |
| 476 // Must be called only after a call to CreateTrialsFromCommandLine(). |
| 477 static void GetInitiallyActiveFieldTrials( |
| 478 const base::CommandLine& command_line, |
| 479 FieldTrial::ActiveGroups* active_groups); |
| 480 |
473 // Use a state string (re: StatesToString()) to augment the current list of | 481 // Use a state string (re: StatesToString()) to augment the current list of |
474 // field trials to include the supplied trials, and using a 100% probability | 482 // field trials to include the supplied trials, and using a 100% probability |
475 // for each trial, force them to have the same group string. This is commonly | 483 // for each trial, force them to have the same group string. This is commonly |
476 // used in a non-browser process, to carry randomly selected state in a | 484 // used in a non-browser process, to carry randomly selected state in a |
477 // browser process into this non-browser process, but could also be invoked | 485 // browser process into this non-browser process, but could also be invoked |
478 // through a command line argument to the browser process. Created field | 486 // through a command line argument to the browser process. Created field |
479 // trials will be marked "used" for the purposes of active trial reporting | 487 // trials will be marked "used" for the purposes of active trial reporting |
480 // if they are prefixed with |kActivationMarker|. Trial names in | 488 // if they are prefixed with |kActivationMarker|. Trial names in |
481 // |ignored_trial_names| are ignored when parsing |trials_string|. | 489 // |ignored_trial_names| are ignored when parsing |trials_string|. |
482 static bool CreateTrialsFromString( | 490 static bool CreateTrialsFromString( |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 // to start passing more data other than field trials. | 622 // to start passing more data other than field trials. |
615 std::unique_ptr<FieldTrialAllocator> field_trial_allocator_ = nullptr; | 623 std::unique_ptr<FieldTrialAllocator> field_trial_allocator_ = nullptr; |
616 | 624 |
617 #if defined(OS_WIN) | 625 #if defined(OS_WIN) |
618 // Readonly copy of the handle to the allocator. Needs to be a member variable | 626 // Readonly copy of the handle to the allocator. Needs to be a member variable |
619 // because it's needed from both CopyFieldTrialStateToFlags() and | 627 // because it's needed from both CopyFieldTrialStateToFlags() and |
620 // AppendFieldTrialHandleIfNeeded(). | 628 // AppendFieldTrialHandleIfNeeded(). |
621 HANDLE readonly_allocator_handle_ = nullptr; | 629 HANDLE readonly_allocator_handle_ = nullptr; |
622 #endif | 630 #endif |
623 | 631 |
| 632 // Tracks whether CreateTrialsFromCommandLine() has been called. |
| 633 bool create_trials_from_command_line_called_ = false; |
| 634 |
624 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); | 635 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); |
625 }; | 636 }; |
626 | 637 |
627 } // namespace base | 638 } // namespace base |
628 | 639 |
629 #endif // BASE_METRICS_FIELD_TRIAL_H_ | 640 #endif // BASE_METRICS_FIELD_TRIAL_H_ |
OLD | NEW |