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

Unified Diff: base/metrics/field_trial.cc

Issue 10382018: Added a SetForced method to allow forcing a new set of group bucketting. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Better wording for the header comments of the new method. Created 8 years, 7 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/metrics/field_trial.h ('k') | base/metrics/field_trial_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/field_trial.cc
diff --git a/base/metrics/field_trial.cc b/base/metrics/field_trial.cc
index 245f2bf02a6a6e07c4ff0f625c91397f2c04a657..6d4f2eb06b2d47c28dde9c2389e68d4814551cae 100644
--- a/base/metrics/field_trial.cc
+++ b/base/metrics/field_trial.cc
@@ -170,6 +170,21 @@ void FieldTrial::EnableBenchmarking() {
enable_benchmarking_ = true;
}
+void FieldTrial::SetForced() {
+ // We might have been forced before (e.g., by CreateFieldTrial) and it's
+ // first come first served, e.g., command line switch has precedence.
+ if (forced_)
+ return;
+ // Explicit forcing should only be for cases where we want to set the group
+ // probabilities before the hard coded field trial setup is executed. So
+ // there must have been at least one non-default group appended at that point.
+ DCHECK_GT(next_group_number_, kDefaultGroupNumber + 1);
+
+ // And we must finalize the group choice before we mark ourselves as forced.
+ group();
+ forced_ = true;
+}
+
FieldTrial::~FieldTrial() {}
void FieldTrial::SetGroupChoice(const std::string& name, int number) {
« no previous file with comments | « base/metrics/field_trial.h ('k') | base/metrics/field_trial_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698