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

Unified Diff: components/variations/variations_seed_processor.cc

Issue 2119713002: Fix crash when variation parameters are set in chrome://flags. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/variations/variations_seed_processor.cc
diff --git a/components/variations/variations_seed_processor.cc b/components/variations/variations_seed_processor.cc
index fb4d7e56700188ce290b8ade8c9fcd3c4e8b93c2..dece0a083bd4fddc6add6c57294a471c23b67eae 100644
--- a/components/variations/variations_seed_processor.cc
+++ b/components/variations/variations_seed_processor.cc
@@ -275,6 +275,14 @@ void VariationsSeedProcessor::CreateTrialFromStudy(
randomization_seed, NULL,
ShouldStudyUseLowEntropy(study) ? low_entropy_provider : NULL));
+ // If the trial previously existed (created from command-line flags or from
+ // about:flags), the factory returns the existing trial keeping its selected
+ // group intact. If this selected group does not exist in this
+ // |processed_study|, we have nothing to do here any more.
+ const std::string& group_name = trial->group_name();
Alexei Svitkine (slow) 2016/06/30 21:50:59 Nit: Just inline this into the call below.
jkrcal 2016/07/01 10:40:54 Done.
+ int experiment_index = processed_study.GetExperimentIndexByName(group_name);
+ if (experiment_index == -1) return;
Alexei Svitkine (slow) 2016/06/30 21:50:59 Nit: Put return on next line.
jkrcal 2016/07/01 10:40:54 Done.
+
bool has_overrides = false;
bool enables_or_disables_features = false;
for (int i = 0; i < study.experiment_size(); ++i) {
@@ -309,20 +317,11 @@ void VariationsSeedProcessor::CreateTrialFromStudy(
RegisterFeatureOverrides(processed_study, trial.get(), feature_list);
if (study.activation_type() == Study_ActivationType_ACTIVATION_AUTO) {
- const std::string& group_name = trial->group_name();
-
// Don't try to apply overrides if none of the experiments in this study had
// any.
if (!has_overrides)
return;
- // UI Strings can only be overridden from ACTIVATION_AUTO experiments.
- int experiment_index = processed_study.GetExperimentIndexByName(group_name);
-
- // The field trial was defined from |study|, so the active experiment's name
- // must be in the |study|.
- DCHECK_NE(-1, experiment_index);
-
ApplyUIStringOverrides(study.experiment(experiment_index),
override_callback);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698