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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 void FieldTrial::FinalizeGroupChoiceImpl(bool is_locked) { | 400 void FieldTrial::FinalizeGroupChoiceImpl(bool is_locked) { |
401 if (group_ != kNotFinalized) | 401 if (group_ != kNotFinalized) |
402 return; | 402 return; |
403 accumulated_group_probability_ = divisor_; | 403 accumulated_group_probability_ = divisor_; |
404 // Here it's OK to use |kDefaultGroupNumber| since we can't be forced and not | 404 // Here it's OK to use |kDefaultGroupNumber| since we can't be forced and not |
405 // finalized. | 405 // finalized. |
406 DCHECK(!forced_); | 406 DCHECK(!forced_); |
407 SetGroupChoice(default_group_name_, kDefaultGroupNumber); | 407 SetGroupChoice(default_group_name_, kDefaultGroupNumber); |
408 | 408 |
409 // Add the field trial to shared memory. | 409 // Add the field trial to shared memory. |
410 if (kUseSharedMemoryForFieldTrials) | 410 if (kUseSharedMemoryForFieldTrials && trial_registered_) |
411 FieldTrialList::OnGroupFinalized(is_locked, this); | 411 FieldTrialList::OnGroupFinalized(is_locked, this); |
412 } | 412 } |
413 | 413 |
414 bool FieldTrial::GetActiveGroup(ActiveGroup* active_group) const { | 414 bool FieldTrial::GetActiveGroup(ActiveGroup* active_group) const { |
415 if (!group_reported_ || !enable_field_trial_) | 415 if (!group_reported_ || !enable_field_trial_) |
416 return false; | 416 return false; |
417 DCHECK_NE(group_, kNotFinalized); | 417 DCHECK_NE(group_, kNotFinalized); |
418 active_group->trial_name = trial_name_; | 418 active_group->trial_name = trial_name_; |
419 active_group->group_name = group_name_; | 419 active_group->group_name = group_name_; |
420 return true; | 420 return true; |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 return; | 1108 return; |
1109 } | 1109 } |
1110 AutoLock auto_lock(global_->lock_); | 1110 AutoLock auto_lock(global_->lock_); |
1111 CHECK(!global_->PreLockedFind(trial->trial_name())) << trial->trial_name(); | 1111 CHECK(!global_->PreLockedFind(trial->trial_name())) << trial->trial_name(); |
1112 trial->AddRef(); | 1112 trial->AddRef(); |
1113 trial->SetTrialRegistered(); | 1113 trial->SetTrialRegistered(); |
1114 global_->registered_[trial->trial_name()] = trial; | 1114 global_->registered_[trial->trial_name()] = trial; |
1115 } | 1115 } |
1116 | 1116 |
1117 } // namespace base | 1117 } // namespace base |
OLD | NEW |