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

Side by Side Diff: components/variations/variations_seed_simulator.cc

Issue 2851703004: [Field trials] Allow default group names to be omitted. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/variations/variations_seed_simulator.h" 5 #include "components/variations/variations_seed_simulator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 10
(...skipping 25 matching lines...) Expand all
36 const ProcessedStudy& processed_study) { 36 const ProcessedStudy& processed_study) {
37 const Study& study = *processed_study.study(); 37 const Study& study = *processed_study.study();
38 DCHECK_EQ(Study_Consistency_PERMANENT, study.consistency()); 38 DCHECK_EQ(Study_Consistency_PERMANENT, study.consistency());
39 39
40 const double entropy_value = 40 const double entropy_value =
41 entropy_provider.GetEntropyForTrial(study.name(), 41 entropy_provider.GetEntropyForTrial(study.name(),
42 study.randomization_seed()); 42 study.randomization_seed());
43 scoped_refptr<base::FieldTrial> trial( 43 scoped_refptr<base::FieldTrial> trial(
44 base::FieldTrial::CreateSimulatedFieldTrial( 44 base::FieldTrial::CreateSimulatedFieldTrial(
45 study.name(), processed_study.total_probability(), 45 study.name(), processed_study.total_probability(),
46 study.default_experiment_name(), entropy_value)); 46 processed_study.GetDefaultExperimentName(), entropy_value));
47 47
48 for (int i = 0; i < study.experiment_size(); ++i) { 48 for (int i = 0; i < study.experiment_size(); ++i) {
49 const Study_Experiment& experiment = study.experiment(i); 49 const Study_Experiment& experiment = study.experiment(i);
50 // TODO(asvitkine): This needs to properly handle the case where a group was 50 // TODO(asvitkine): This needs to properly handle the case where a group was
51 // forced via forcing_flag in the current state, so that it is not treated 51 // forced via forcing_flag in the current state, so that it is not treated
52 // as changed. 52 // as changed.
53 if (!experiment.has_forcing_flag() && 53 if (!experiment.has_forcing_flag() &&
54 experiment.name() != study.default_experiment_name()) { 54 experiment.name() != study.default_experiment_name()) {
55 trial->AppendGroup(experiment.name(), experiment.probability_weight()); 55 trial->AppendGroup(experiment.name(), experiment.probability_weight());
56 } 56 }
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 return ConvertExperimentTypeToChangeType(experiment->type()); 256 return ConvertExperimentTypeToChangeType(experiment->type());
257 } 257 }
258 258
259 // Current group exists in the study - check whether its params changed. 259 // Current group exists in the study - check whether its params changed.
260 if (!VariationParamsAreEqual(study, *experiment)) 260 if (!VariationParamsAreEqual(study, *experiment))
261 return ConvertExperimentTypeToChangeType(experiment->type()); 261 return ConvertExperimentTypeToChangeType(experiment->type());
262 return NO_CHANGE; 262 return NO_CHANGE;
263 } 263 }
264 264
265 } // namespace variations 265 } // namespace variations
OLDNEW
« 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