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

Unified Diff: base/field_trial.cc

Issue 150141: Implement shortcut for finalizing a trial with all remaining probability... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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/field_trial.h ('k') | base/field_trial_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/field_trial.cc
===================================================================
--- base/field_trial.cc (revision 19682)
+++ base/field_trial.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -36,10 +36,15 @@
int FieldTrial::AppendGroup(const std::string& name,
Probability group_probability) {
DCHECK(group_probability <= divisor_);
- accumulated_group_probability_ += group_probability;
+ DCHECK(group_probability >=0 ||
+ group_probability == kAllRemainingProbability);
+ if (group_probability == kAllRemainingProbability)
+ accumulated_group_probability_ = divisor_;
+ else
+ accumulated_group_probability_ += group_probability;
DCHECK(accumulated_group_probability_ <= divisor_);
if (group_ == kNotParticipating && accumulated_group_probability_ > random_) {
- // This is the group that crossed the random line, so we do teh assignment.
+ // This is the group that crossed the random line, so we do the assignment.
group_ = next_group_number_;
if (name.empty())
StringAppendF(&group_name_, "_%d", group_);
« no previous file with comments | « base/field_trial.h ('k') | base/field_trial_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698