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

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

Issue 688973004: Plumbing for variations headers from synthetic field trials. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Expose another hashed API in variations_associated_data.h Created 6 years, 1 month 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_associated_data.h" 5 #include "components/variations/variations_associated_data.h"
6 6
7 #include <map> 7 #include <map>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 const std::string& group_name, 177 const std::string& group_name,
178 VariationID id) { 178 VariationID id) {
179 GroupMapAccessor::GetInstance()->AssociateID( 179 GroupMapAccessor::GetInstance()->AssociateID(
180 key, MakeActiveGroupId(trial_name, group_name), id, false); 180 key, MakeActiveGroupId(trial_name, group_name), id, false);
181 } 181 }
182 182
183 void AssociateGoogleVariationIDForce(IDCollectionKey key, 183 void AssociateGoogleVariationIDForce(IDCollectionKey key,
184 const std::string& trial_name, 184 const std::string& trial_name,
185 const std::string& group_name, 185 const std::string& group_name,
186 VariationID id) { 186 VariationID id) {
187 GroupMapAccessor::GetInstance()->AssociateID( 187 AssociateGoogleVariationIDForceHashes(
188 key, MakeActiveGroupId(trial_name, group_name), id, true); 188 key, MakeActiveGroupId(trial_name, group_name), id);
189 }
190
191 void AssociateGoogleVariationIDForceHashes(IDCollectionKey key,
192 const ActiveGroupId& active_group,
193 VariationID id) {
194 GroupMapAccessor::GetInstance()->AssociateID(key, active_group, id, true);
189 } 195 }
190 196
191 VariationID GetGoogleVariationID(IDCollectionKey key, 197 VariationID GetGoogleVariationID(IDCollectionKey key,
192 const std::string& trial_name, 198 const std::string& trial_name,
193 const std::string& group_name) { 199 const std::string& group_name) {
194 return GroupMapAccessor::GetInstance()->GetID( 200 return GetGoogleVariationIDFromHashes(
195 key, MakeActiveGroupId(trial_name, group_name)); 201 key, MakeActiveGroupId(trial_name, group_name));
196 } 202 }
197 203
204 VariationID GetGoogleVariationIDFromHashes(
205 IDCollectionKey key,
206 const ActiveGroupId& active_group) {
207 return GroupMapAccessor::GetInstance()->GetID(key, active_group);
208 }
209
198 bool AssociateVariationParams( 210 bool AssociateVariationParams(
199 const std::string& trial_name, 211 const std::string& trial_name,
200 const std::string& group_name, 212 const std::string& group_name,
201 const std::map<std::string, std::string>& params) { 213 const std::map<std::string, std::string>& params) {
202 return VariationsParamAssociator::GetInstance()->AssociateVariationParams( 214 return VariationsParamAssociator::GetInstance()->AssociateVariationParams(
203 trial_name, group_name, params); 215 trial_name, group_name, params);
204 } 216 }
205 217
206 bool GetVariationParams(const std::string& trial_name, 218 bool GetVariationParams(const std::string& trial_name,
207 std::map<std::string, std::string>* params) { 219 std::map<std::string, std::string>* params) {
(...skipping 20 matching lines...) Expand all
228 GroupMapAccessor::GetInstance()->ClearAllMapsForTesting(); 240 GroupMapAccessor::GetInstance()->ClearAllMapsForTesting();
229 } 241 }
230 242
231 void ClearAllVariationParams() { 243 void ClearAllVariationParams() {
232 VariationsParamAssociator::GetInstance()->ClearAllParamsForTesting(); 244 VariationsParamAssociator::GetInstance()->ClearAllParamsForTesting();
233 } 245 }
234 246
235 } // namespace testing 247 } // namespace testing
236 248
237 } // namespace variations 249 } // namespace variations
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698