| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 return group_; | 132 return group_; |
| 133 } | 133 } |
| 134 | 134 |
| 135 const std::string& FieldTrial::group_name() { | 135 const std::string& FieldTrial::group_name() { |
| 136 // Call |group()| to ensure group gets assigned and observers are notified. | 136 // Call |group()| to ensure group gets assigned and observers are notified. |
| 137 group(); | 137 group(); |
| 138 DCHECK(!group_name_.empty()); | 138 DCHECK(!group_name_.empty()); |
| 139 return group_name_; | 139 return group_name_; |
| 140 } | 140 } |
| 141 | 141 |
| 142 const std::string& FieldTrial::GetGroupNameWithoutActivation() { |
| 143 FinalizeGroupChoice(); |
| 144 return group_name_; |
| 145 } |
| 146 |
| 142 void FieldTrial::SetForced() { | 147 void FieldTrial::SetForced() { |
| 143 // We might have been forced before (e.g., by CreateFieldTrial) and it's | 148 // We might have been forced before (e.g., by CreateFieldTrial) and it's |
| 144 // first come first served, e.g., command line switch has precedence. | 149 // first come first served, e.g., command line switch has precedence. |
| 145 if (forced_) | 150 if (forced_) |
| 146 return; | 151 return; |
| 147 | 152 |
| 148 // And we must finalize the group choice before we mark ourselves as forced. | 153 // And we must finalize the group choice before we mark ourselves as forced. |
| 149 FinalizeGroupChoice(); | 154 FinalizeGroupChoice(); |
| 150 forced_ = true; | 155 forced_ = true; |
| 151 } | 156 } |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 return; | 588 return; |
| 584 } | 589 } |
| 585 AutoLock auto_lock(global_->lock_); | 590 AutoLock auto_lock(global_->lock_); |
| 586 DCHECK(!global_->PreLockedFind(trial->trial_name())); | 591 DCHECK(!global_->PreLockedFind(trial->trial_name())); |
| 587 trial->AddRef(); | 592 trial->AddRef(); |
| 588 trial->SetTrialRegistered(); | 593 trial->SetTrialRegistered(); |
| 589 global_->registered_[trial->trial_name()] = trial; | 594 global_->registered_[trial->trial_name()] = trial; |
| 590 } | 595 } |
| 591 | 596 |
| 592 } // namespace base | 597 } // namespace base |
| OLD | NEW |