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

Unified Diff: base/metrics/field_trial.cc

Issue 7204004: Add back a check for improper usage of IsOneTimeRandomizationEnabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to lkgr. Created 9 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/metrics/field_trial.h ('k') | no next file » | 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 190ebcf0254a2bb0021464e8659100d423585106..2c87f073492e66cbb01d8303abb34155945b766e 100644
--- a/base/metrics/field_trial.cc
+++ b/base/metrics/field_trial.cc
@@ -189,14 +189,14 @@ double FieldTrial::HashClientId(const std::string& client_id,
FieldTrialList* FieldTrialList::global_ = NULL;
// static
-bool FieldTrialList::register_without_global_ = false;
+bool FieldTrialList::used_without_global_ = false;
FieldTrialList::FieldTrialList(const std::string& client_id)
: application_start_time_(TimeTicks::Now()),
client_id_(client_id),
observer_list_(ObserverList<Observer>::NOTIFY_EXISTING_ONLY) {
DCHECK(!global_);
- DCHECK(!register_without_global_);
+ DCHECK(!used_without_global_);
global_ = this;
Time::Exploded exploded;
@@ -220,7 +220,7 @@ FieldTrialList::~FieldTrialList() {
// static
void FieldTrialList::Register(FieldTrial* trial) {
if (!global_) {
- register_without_global_ = true;
+ used_without_global_ = true;
return;
}
AutoLock auto_lock(global_->lock_);
@@ -369,11 +369,10 @@ size_t FieldTrialList::GetFieldTrialCount() {
// static
bool FieldTrialList::IsOneTimeRandomizationEnabled() {
- // TODO(joi): Put back a DCHECK(global_) here. First, need to make sure all
- // unit test executables have exactly one FieldTrialList instance (currently
- // they have 0 or 1).
- if (!global_)
+ if (!global_) {
+ used_without_global_ = true;
return false;
+ }
return !global_->client_id_.empty();
}
« no previous file with comments | « base/metrics/field_trial.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698