| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 void FieldTrial::FinalizeGroupChoiceImpl(bool is_locked) { | 355 void FieldTrial::FinalizeGroupChoiceImpl(bool is_locked) { |
| 356 if (group_ != kNotFinalized) | 356 if (group_ != kNotFinalized) |
| 357 return; | 357 return; |
| 358 accumulated_group_probability_ = divisor_; | 358 accumulated_group_probability_ = divisor_; |
| 359 // Here it's OK to use |kDefaultGroupNumber| since we can't be forced and not | 359 // Here it's OK to use |kDefaultGroupNumber| since we can't be forced and not |
| 360 // finalized. | 360 // finalized. |
| 361 DCHECK(!forced_); | 361 DCHECK(!forced_); |
| 362 SetGroupChoice(default_group_name_, kDefaultGroupNumber); | 362 SetGroupChoice(default_group_name_, kDefaultGroupNumber); |
| 363 | 363 |
| 364 // Add the field trial to shared memory. | 364 // Add the field trial to shared memory. |
| 365 if (kUseSharedMemoryForFieldTrials) | 365 if (kUseSharedMemoryForFieldTrials && trial_registered_) |
| 366 FieldTrialList::OnGroupFinalized(is_locked, this); | 366 FieldTrialList::OnGroupFinalized(is_locked, this); |
| 367 } | 367 } |
| 368 | 368 |
| 369 bool FieldTrial::GetActiveGroup(ActiveGroup* active_group) const { | 369 bool FieldTrial::GetActiveGroup(ActiveGroup* active_group) const { |
| 370 if (!group_reported_ || !enable_field_trial_) | 370 if (!group_reported_ || !enable_field_trial_) |
| 371 return false; | 371 return false; |
| 372 DCHECK_NE(group_, kNotFinalized); | 372 DCHECK_NE(group_, kNotFinalized); |
| 373 active_group->trial_name = trial_name_; | 373 active_group->trial_name = trial_name_; |
| 374 active_group->group_name = group_name_; | 374 active_group->group_name = group_name_; |
| 375 return true; | 375 return true; |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 return; | 1010 return; |
| 1011 } | 1011 } |
| 1012 AutoLock auto_lock(global_->lock_); | 1012 AutoLock auto_lock(global_->lock_); |
| 1013 CHECK(!global_->PreLockedFind(trial->trial_name())) << trial->trial_name(); | 1013 CHECK(!global_->PreLockedFind(trial->trial_name())) << trial->trial_name(); |
| 1014 trial->AddRef(); | 1014 trial->AddRef(); |
| 1015 trial->SetTrialRegistered(); | 1015 trial->SetTrialRegistered(); |
| 1016 global_->registered_[trial->trial_name()] = trial; | 1016 global_->registered_[trial->trial_name()] = trial; |
| 1017 } | 1017 } |
| 1018 | 1018 |
| 1019 } // namespace base | 1019 } // namespace base |
| OLD | NEW |