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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 return; | 595 return; |
591 } | 596 } |
592 AutoLock auto_lock(global_->lock_); | 597 AutoLock auto_lock(global_->lock_); |
593 DCHECK(!global_->PreLockedFind(trial->trial_name())); | 598 DCHECK(!global_->PreLockedFind(trial->trial_name())); |
594 trial->AddRef(); | 599 trial->AddRef(); |
595 trial->SetTrialRegistered(); | 600 trial->SetTrialRegistered(); |
596 global_->registered_[trial->trial_name()] = trial; | 601 global_->registered_[trial->trial_name()] = trial; |
597 } | 602 } |
598 | 603 |
599 } // namespace base | 604 } // namespace base |
OLD | NEW |