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

Unified Diff: components/variations/variations_seed_processor.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
Index: components/variations/variations_seed_processor.cc
diff --git a/components/variations/variations_seed_processor.cc b/components/variations/variations_seed_processor.cc
index e169e7541019845df4e4438bc90be1692b8cd0b2..ff7b6cccc2ce4881b2725d2a0bd68cf1c727bf11 100644
--- a/components/variations/variations_seed_processor.cc
+++ b/components/variations/variations_seed_processor.cc
@@ -168,6 +168,19 @@ bool ShouldForceExperiment(const Study_Experiment& experiment,
return false;
}
+bool ShouldStudyUseLowEntropy(const Study& study) {
+ for (int i = 0; i < study.experiment_size(); ++i) {
+ const Study_Experiment& experiment = study.experiment(i);
+ if (experiment.has_google_web_experiment_id() ||
+ experiment.has_google_web_trigger_experiment_id() ||
+ experiment.has_google_update_experiment_id() ||
+ experiment.has_chrome_sync_experiment_id()) {
+ return true;
+ }
+ }
+ return false;
+}
+
} // namespace
VariationsSeedProcessor::VariationsSeedProcessor() {
@@ -187,7 +200,8 @@ void VariationsSeedProcessor::CreateTrialsFromSeed(
const std::string& session_consistency_country,
const std::string& permanent_consistency_country,
const UIStringOverrideCallback& override_callback,
- base::FeatureList* feature_list) {
+ base::FeatureList* feature_list,
+ const base::FieldTrial::EntropyProvider* low_entropy_provider) {
std::vector<ProcessedStudy> filtered_studies;
FilterAndValidateStudies(seed, locale, reference_date, version, channel,
form_factor, hardware_class,
@@ -195,13 +209,15 @@ void VariationsSeedProcessor::CreateTrialsFromSeed(
permanent_consistency_country, &filtered_studies);
for (size_t i = 0; i < filtered_studies.size(); ++i)
- CreateTrialFromStudy(filtered_studies[i], override_callback, feature_list);
+ CreateTrialFromStudy(filtered_studies[i], override_callback, feature_list,
+ low_entropy_provider);
}
void VariationsSeedProcessor::CreateTrialFromStudy(
const ProcessedStudy& processed_study,
const UIStringOverrideCallback& override_callback,
- base::FeatureList* feature_list) {
+ base::FeatureList* feature_list,
+ const base::FieldTrial::EntropyProvider* low_entropy_provider) {
const Study& study = *processed_study.study();
// Check if any experiments need to be forced due to a command line
@@ -255,7 +271,8 @@ void VariationsSeedProcessor::CreateTrialFromStudy(
study.name(), processed_study.total_probability(),
study.default_experiment_name(),
base::FieldTrialList::kNoExpirationYear, 1, 1, randomization_type,
- randomization_seed, NULL));
+ randomization_seed, NULL,
+ ShouldStudyUseLowEntropy(study) ? low_entropy_provider : NULL));
bool has_overrides = false;
bool enables_or_disables_features = false;

Powered by Google App Engine
This is Rietveld 408576698