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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 kNonConflictingGroupNumber != FieldTrial::kNotFinalized, | 313 kNonConflictingGroupNumber != FieldTrial::kNotFinalized, |
314 conflicting_default_group_number); | 314 conflicting_default_group_number); |
315 *default_group_number = kNonConflictingGroupNumber; | 315 *default_group_number = kNonConflictingGroupNumber; |
316 } | 316 } |
317 } | 317 } |
318 return existing_trial; | 318 return existing_trial; |
319 } | 319 } |
320 | 320 |
321 double entropy_value; | 321 double entropy_value; |
322 if (randomization_type == FieldTrial::ONE_TIME_RANDOMIZED) { | 322 if (randomization_type == FieldTrial::ONE_TIME_RANDOMIZED) { |
323 entropy_value = GetEntropyProviderForOneTimeRandomization()-> | 323 const FieldTrial::EntropyProvider* entropy_provider = |
324 GetEntropyForTrial(trial_name, randomization_seed); | 324 GetEntropyProviderForOneTimeRandomization(); |
| 325 CHECK(entropy_provider); |
| 326 entropy_value = entropy_provider->GetEntropyForTrial(trial_name, |
| 327 randomization_seed); |
325 } else { | 328 } else { |
326 DCHECK_EQ(FieldTrial::SESSION_RANDOMIZED, randomization_type); | 329 DCHECK_EQ(FieldTrial::SESSION_RANDOMIZED, randomization_type); |
327 DCHECK_EQ(0U, randomization_seed); | 330 DCHECK_EQ(0U, randomization_seed); |
328 entropy_value = RandDouble(); | 331 entropy_value = RandDouble(); |
329 } | 332 } |
330 | 333 |
331 FieldTrial* field_trial = new FieldTrial(trial_name, total_probability, | 334 FieldTrial* field_trial = new FieldTrial(trial_name, total_probability, |
332 default_group_name, entropy_value); | 335 default_group_name, entropy_value); |
333 if (GetBuildTime() > CreateTimeFromParams(year, month, day_of_month)) | 336 if (GetBuildTime() > CreateTimeFromParams(year, month, day_of_month)) |
334 field_trial->Disable(); | 337 field_trial->Disable(); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 return; | 536 return; |
534 } | 537 } |
535 AutoLock auto_lock(global_->lock_); | 538 AutoLock auto_lock(global_->lock_); |
536 DCHECK(!global_->PreLockedFind(trial->trial_name())); | 539 DCHECK(!global_->PreLockedFind(trial->trial_name())); |
537 trial->AddRef(); | 540 trial->AddRef(); |
538 trial->SetTrialRegistered(); | 541 trial->SetTrialRegistered(); |
539 global_->registered_[trial->trial_name()] = trial; | 542 global_->registered_[trial->trial_name()] = trial; |
540 } | 543 } |
541 | 544 |
542 } // namespace base | 545 } // namespace base |
OLD | NEW |