Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1542)

Unified Diff: base/metrics/field_trial.cc

Issue 1984003002: Use low entropy for studies that send experiment IDs to Google properties. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/metrics/field_trial.h ('k') | base/test/mock_entropy_provider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/field_trial.cc
diff --git a/base/metrics/field_trial.cc b/base/metrics/field_trial.cc
index b5dea9b3628c3f9a5fc347949651387e089684ac..1e6218a5f9141b222690d1aef622fd7b572e1250 100644
--- a/base/metrics/field_trial.cc
+++ b/base/metrics/field_trial.cc
@@ -381,8 +381,8 @@ FieldTrial* FieldTrialList::FactoryGetFieldTrial(
FieldTrial::RandomizationType randomization_type,
int* default_group_number) {
return FactoryGetFieldTrialWithRandomizationSeed(
- trial_name, total_probability, default_group_name,
- year, month, day_of_month, randomization_type, 0, default_group_number);
+ trial_name, total_probability, default_group_name, year, month,
+ day_of_month, randomization_type, 0, default_group_number, NULL);
}
// static
@@ -395,7 +395,8 @@ FieldTrial* FieldTrialList::FactoryGetFieldTrialWithRandomizationSeed(
const int day_of_month,
FieldTrial::RandomizationType randomization_type,
uint32_t randomization_seed,
- int* default_group_number) {
+ int* default_group_number,
+ const FieldTrial::EntropyProvider* override_entropy_provider) {
if (default_group_number)
*default_group_number = FieldTrial::kDefaultGroupNumber;
// Check if the field trial has already been created in some other way.
@@ -429,8 +430,10 @@ FieldTrial* FieldTrialList::FactoryGetFieldTrialWithRandomizationSeed(
double entropy_value;
if (randomization_type == FieldTrial::ONE_TIME_RANDOMIZED) {
+ // If an override entropy provider is given, use it.
const FieldTrial::EntropyProvider* entropy_provider =
- GetEntropyProviderForOneTimeRandomization();
+ override_entropy_provider ? override_entropy_provider
+ : GetEntropyProviderForOneTimeRandomization();
CHECK(entropy_provider);
entropy_value = entropy_provider->GetEntropyForTrial(trial_name,
randomization_seed);
« no previous file with comments | « base/metrics/field_trial.h ('k') | base/test/mock_entropy_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698