| OLD | NEW |
| 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 #include "base/metrics/field_trial.h" | 5 #include "base/metrics/field_trial.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/build_time.h" | 9 #include "base/build_time.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 | 291 |
| 292 // static | 292 // static |
| 293 FieldTrial* FieldTrialList::FactoryGetFieldTrialWithRandomizationSeed( | 293 FieldTrial* FieldTrialList::FactoryGetFieldTrialWithRandomizationSeed( |
| 294 const std::string& trial_name, | 294 const std::string& trial_name, |
| 295 FieldTrial::Probability total_probability, | 295 FieldTrial::Probability total_probability, |
| 296 const std::string& default_group_name, | 296 const std::string& default_group_name, |
| 297 const int year, | 297 const int year, |
| 298 const int month, | 298 const int month, |
| 299 const int day_of_month, | 299 const int day_of_month, |
| 300 FieldTrial::RandomizationType randomization_type, | 300 FieldTrial::RandomizationType randomization_type, |
| 301 uint32 randomization_seed, | 301 uint32_t randomization_seed, |
| 302 int* default_group_number) { | 302 int* default_group_number) { |
| 303 if (default_group_number) | 303 if (default_group_number) |
| 304 *default_group_number = FieldTrial::kDefaultGroupNumber; | 304 *default_group_number = FieldTrial::kDefaultGroupNumber; |
| 305 // Check if the field trial has already been created in some other way. | 305 // Check if the field trial has already been created in some other way. |
| 306 FieldTrial* existing_trial = Find(trial_name); | 306 FieldTrial* existing_trial = Find(trial_name); |
| 307 if (existing_trial) { | 307 if (existing_trial) { |
| 308 CHECK(existing_trial->forced_); | 308 CHECK(existing_trial->forced_); |
| 309 // If the default group name differs between the existing forced trial | 309 // If the default group name differs between the existing forced trial |
| 310 // and this trial, then use a different value for the default group number. | 310 // and this trial, then use a different value for the default group number. |
| 311 if (default_group_number && | 311 if (default_group_number && |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 return; | 589 return; |
| 590 } | 590 } |
| 591 AutoLock auto_lock(global_->lock_); | 591 AutoLock auto_lock(global_->lock_); |
| 592 DCHECK(!global_->PreLockedFind(trial->trial_name())); | 592 DCHECK(!global_->PreLockedFind(trial->trial_name())); |
| 593 trial->AddRef(); | 593 trial->AddRef(); |
| 594 trial->SetTrialRegistered(); | 594 trial->SetTrialRegistered(); |
| 595 global_->registered_[trial->trial_name()] = trial; | 595 global_->registered_[trial->trial_name()] = trial; |
| 596 } | 596 } |
| 597 | 597 |
| 598 } // namespace base | 598 } // namespace base |
| OLD | NEW |