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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 // If the new default group number corresponds to the group that was | 318 // If the new default group number corresponds to the group that was |
319 // chosen for the forced trial (which has been finalized when it was | 319 // chosen for the forced trial (which has been finalized when it was |
320 // forced), then set the default group number to that. | 320 // forced), then set the default group number to that. |
321 if (default_group_name == existing_trial->group_name_internal()) { | 321 if (default_group_name == existing_trial->group_name_internal()) { |
322 *default_group_number = existing_trial->group_; | 322 *default_group_number = existing_trial->group_; |
323 } else { | 323 } else { |
324 // Otherwise, use |kNonConflictingGroupNumber| (-2) for the default | 324 // Otherwise, use |kNonConflictingGroupNumber| (-2) for the default |
325 // group number, so that it does not conflict with the |AppendGroup()| | 325 // group number, so that it does not conflict with the |AppendGroup()| |
326 // result for the chosen group. | 326 // result for the chosen group. |
327 const int kNonConflictingGroupNumber = -2; | 327 const int kNonConflictingGroupNumber = -2; |
328 COMPILE_ASSERT( | 328 static_assert( |
329 kNonConflictingGroupNumber != FieldTrial::kDefaultGroupNumber, | 329 kNonConflictingGroupNumber != FieldTrial::kDefaultGroupNumber, |
330 conflicting_default_group_number); | 330 "The 'non-conflicting' group number conflicts"); |
331 COMPILE_ASSERT( | 331 static_assert(kNonConflictingGroupNumber != FieldTrial::kNotFinalized, |
332 kNonConflictingGroupNumber != FieldTrial::kNotFinalized, | 332 "The 'non-conflicting' group number conflicts"); |
333 conflicting_default_group_number); | |
334 *default_group_number = kNonConflictingGroupNumber; | 333 *default_group_number = kNonConflictingGroupNumber; |
335 } | 334 } |
336 } | 335 } |
337 return existing_trial; | 336 return existing_trial; |
338 } | 337 } |
339 | 338 |
340 double entropy_value; | 339 double entropy_value; |
341 if (randomization_type == FieldTrial::ONE_TIME_RANDOMIZED) { | 340 if (randomization_type == FieldTrial::ONE_TIME_RANDOMIZED) { |
342 const FieldTrial::EntropyProvider* entropy_provider = | 341 const FieldTrial::EntropyProvider* entropy_provider = |
343 GetEntropyProviderForOneTimeRandomization(); | 342 GetEntropyProviderForOneTimeRandomization(); |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 return; | 594 return; |
596 } | 595 } |
597 AutoLock auto_lock(global_->lock_); | 596 AutoLock auto_lock(global_->lock_); |
598 DCHECK(!global_->PreLockedFind(trial->trial_name())); | 597 DCHECK(!global_->PreLockedFind(trial->trial_name())); |
599 trial->AddRef(); | 598 trial->AddRef(); |
600 trial->SetTrialRegistered(); | 599 trial->SetTrialRegistered(); |
601 global_->registered_[trial->trial_name()] = trial; | 600 global_->registered_[trial->trial_name()] = trial; |
602 } | 601 } |
603 | 602 |
604 } // namespace base | 603 } // namespace base |
OLD | NEW |