Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: base/metrics/field_trial.h

Issue 2504163005: Fix getting initially active trials with shared memory. (Closed)
Patch Set: Fix single process mode which is used by PhishingClassifierTest on Windows. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/metrics/field_trial.cc » ('j') | base/metrics/field_trial.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 // has been chosen and externally observed (via |group()|) and which have 459 // has been chosen and externally observed (via |group()|) and which have
460 // not been disabled. 460 // not been disabled.
461 static void GetActiveFieldTrialGroups( 461 static void GetActiveFieldTrialGroups(
462 FieldTrial::ActiveGroups* active_groups); 462 FieldTrial::ActiveGroups* active_groups);
463 463
464 // Returns the field trials that are marked active in |trials_string|. 464 // Returns the field trials that are marked active in |trials_string|.
465 static void GetActiveFieldTrialGroupsFromString( 465 static void GetActiveFieldTrialGroupsFromString(
466 const std::string& trials_string, 466 const std::string& trials_string,
467 FieldTrial::ActiveGroups* active_groups); 467 FieldTrial::ActiveGroups* active_groups);
468 468
469 // Returns the field trials that were active when the process was
470 // created. Either parses the field trial string or the shared memory
471 // holding field trial information.
472 // Must be called only after a call to CreateTrialsFromCommandLine().
473 static void GetInitiallyActiveFieldTrials(
474 const base::CommandLine& command_line,
475 FieldTrial::ActiveGroups* active_groups);
476
469 // Use a state string (re: StatesToString()) to augment the current list of 477 // Use a state string (re: StatesToString()) to augment the current list of
470 // field trials to include the supplied trials, and using a 100% probability 478 // field trials to include the supplied trials, and using a 100% probability
471 // for each trial, force them to have the same group string. This is commonly 479 // for each trial, force them to have the same group string. This is commonly
472 // used in a non-browser process, to carry randomly selected state in a 480 // used in a non-browser process, to carry randomly selected state in a
473 // browser process into this non-browser process, but could also be invoked 481 // browser process into this non-browser process, but could also be invoked
474 // through a command line argument to the browser process. Created field 482 // through a command line argument to the browser process. Created field
475 // trials will be marked "used" for the purposes of active trial reporting 483 // trials will be marked "used" for the purposes of active trial reporting
476 // if they are prefixed with |kActivationMarker|. Trial names in 484 // if they are prefixed with |kActivationMarker|. Trial names in
477 // |ignored_trial_names| are ignored when parsing |trials_string|. 485 // |ignored_trial_names| are ignored when parsing |trials_string|.
478 static bool CreateTrialsFromString( 486 static bool CreateTrialsFromString(
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 std::unique_ptr<SharedPersistentMemoryAllocator> field_trial_allocator_ = 612 std::unique_ptr<SharedPersistentMemoryAllocator> field_trial_allocator_ =
605 nullptr; 613 nullptr;
606 614
607 #if defined(OS_WIN) 615 #if defined(OS_WIN)
608 // Readonly copy of the handle to the allocator. Needs to be a member variable 616 // Readonly copy of the handle to the allocator. Needs to be a member variable
609 // because it's needed from both CopyFieldTrialStateToFlags() and 617 // because it's needed from both CopyFieldTrialStateToFlags() and
610 // AppendFieldTrialHandleIfNeeded(). 618 // AppendFieldTrialHandleIfNeeded().
611 HANDLE readonly_allocator_handle_ = nullptr; 619 HANDLE readonly_allocator_handle_ = nullptr;
612 #endif 620 #endif
613 621
622 // Tracks whether CreateTrialsFromCommandLine() has been called.
623 bool create_trials_from_command_line_called_ = false;
624
614 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); 625 DISALLOW_COPY_AND_ASSIGN(FieldTrialList);
615 }; 626 };
616 627
617 } // namespace base 628 } // namespace base
618 629
619 #endif // BASE_METRICS_FIELD_TRIAL_H_ 630 #endif // BASE_METRICS_FIELD_TRIAL_H_
OLDNEW
« no previous file with comments | « no previous file | base/metrics/field_trial.cc » ('j') | base/metrics/field_trial.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698