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

Side by Side Diff: base/metrics/field_trial.h

Issue 2633383002: Change FieldTrial::State to not use StringPiece members. (Closed)
Patch Set: Created 3 years, 11 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 | base/metrics/field_trial.cc » ('j') | base/metrics/field_trial.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // FieldTrial is a class for handling details of statistical experiments 5 // FieldTrial is a class for handling details of statistical experiments
6 // performed by actual users in the field (i.e., in a shipped or beta product). 6 // performed by actual users in the field (i.e., in a shipped or beta product).
7 // All code is called exclusively on the UI thread currently. 7 // All code is called exclusively on the UI thread currently.
8 // 8 //
9 // The simplest example is an experiment to see whether one of two options 9 // The simplest example is an experiment to see whether one of two options
10 // produces "better" results across our user population. In that scenario, UMA 10 // produces "better" results across our user population. In that scenario, UMA
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 uint32_t randomization_seed) const = 0; 117 uint32_t randomization_seed) const = 0;
118 }; 118 };
119 119
120 // A pair representing a Field Trial and its selected group. 120 // A pair representing a Field Trial and its selected group.
121 struct ActiveGroup { 121 struct ActiveGroup {
122 std::string trial_name; 122 std::string trial_name;
123 std::string group_name; 123 std::string group_name;
124 }; 124 };
125 125
126 // A triplet representing a FieldTrial, its selected group and whether it's 126 // A triplet representing a FieldTrial, its selected group and whether it's
127 // active. 127 // active. String members are pointers to the underlying strings owned by the
128 // FieldTrial object. Does not use StringPiece to avoid conversions back to
129 // std::string.
128 struct BASE_EXPORT State { 130 struct BASE_EXPORT State {
129 StringPiece trial_name; 131 const std::string* trial_name;
brucedawson 2017/01/24 00:44:14 Consider doing "= nullptr;" here to make it crysta
Alexei Svitkine (slow) 2017/01/24 16:40:19 Done.
130 StringPiece group_name; 132 const std::string* group_name;
131 bool activated; 133 bool activated;
132 134
133 State(); 135 State();
134 State(const State& other); 136 State(const State& other);
135 ~State(); 137 ~State();
136 }; 138 };
137 139
138 // We create one FieldTrialEntry per field trial in shared memory, via 140 // We create one FieldTrialEntry per field trial in shared memory, via
139 // AddToAllocatorWhileLocked. The FieldTrialEntry is followed by a 141 // AddToAllocatorWhileLocked. The FieldTrialEntry is followed by a
140 // base::Pickle object that we unpickle and read from. 142 // base::Pickle object that we unpickle and read from.
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 733
732 // Tracks whether CreateTrialsFromCommandLine() has been called. 734 // Tracks whether CreateTrialsFromCommandLine() has been called.
733 bool create_trials_from_command_line_called_ = false; 735 bool create_trials_from_command_line_called_ = false;
734 736
735 DISALLOW_COPY_AND_ASSIGN(FieldTrialList); 737 DISALLOW_COPY_AND_ASSIGN(FieldTrialList);
736 }; 738 };
737 739
738 } // namespace base 740 } // namespace base
739 741
740 #endif // BASE_METRICS_FIELD_TRIAL_H_ 742 #endif // BASE_METRICS_FIELD_TRIAL_H_
OLDNEW
« no previous file with comments | « no previous file | base/metrics/field_trial.cc » ('j') | base/metrics/field_trial.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698