diff options
author | cbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-25 17:22:46 +0000 |
---|---|---|
committer | cbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-25 17:22:46 +0000 |
commit | 9238ab93a4ba8bfc555e429308a68a53a1b9feda (patch) | |
tree | 1e4f11c19099faa1267dd703f33ee9a5521212a7 /base | |
parent | 7735667abe5e04a00fe1b2f433879592e0c8466e (diff) | |
download | chromium_src-9238ab93a4ba8bfc555e429308a68a53a1b9feda.zip chromium_src-9238ab93a4ba8bfc555e429308a68a53a1b9feda.tar.gz chromium_src-9238ab93a4ba8bfc555e429308a68a53a1b9feda.tar.bz2 |
Minor fixes in FieldTrial.
- Add a DCHECK
- Comment what the return value is on AddGroup
- const a member
- Typo fix
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/6577038
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76061 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/metrics/field_trial.cc | 3 | ||||
-rw-r--r-- | base/metrics/field_trial.h | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/base/metrics/field_trial.cc b/base/metrics/field_trial.cc index fceccde..c1416db 100644 --- a/base/metrics/field_trial.cc +++ b/base/metrics/field_trial.cc @@ -41,6 +41,7 @@ FieldTrial::FieldTrial(const std::string& name, accumulated_group_probability_(0), next_group_number_(kDefaultGroupNumber+1), group_(kNotFinalized) { + DCHECK_GT(total_probability, 0); DCHECK(!default_group_name_.empty()); FieldTrialList::Register(this); @@ -53,7 +54,7 @@ FieldTrial::FieldTrial(const std::string& name, base::Time::Exploded exploded; exploded.year = year; exploded.month = month; - exploded.day_of_week = 0; // Should be unusued. + exploded.day_of_week = 0; // Should be unused. exploded.day_of_month = day_of_month; exploded.hour = 0; exploded.minute = 0; diff --git a/base/metrics/field_trial.h b/base/metrics/field_trial.h index ec3a483..8b4a6069 100644 --- a/base/metrics/field_trial.h +++ b/base/metrics/field_trial.h @@ -101,6 +101,7 @@ class FieldTrial : public RefCounted<FieldTrial> { // Establish the name and probability of the next group in this trial. // Sometimes, based on construction randomization, this call may cause the // provided group to be *THE* group selected for use in this instance. + // The return value is the group number of the new group. int AppendGroup(const std::string& name, Probability group_probability); // Return the name of the FieldTrial (excluding the group name). @@ -167,7 +168,7 @@ class FieldTrial : public RefCounted<FieldTrial> { // The randomly selected probability that is used to select a group (or have // the instance not participate). It is the product of divisor_ and a random // number between [0, 1). - Probability random_; + const Probability random_; // Sum of the probabilities of all appended groups. Probability accumulated_group_probability_; |