| OLD | NEW |
| 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 20 matching lines...) Expand all Loading... |
| 31 return base::Singleton<GroupMapAccessor>::get(); | 31 return base::Singleton<GroupMapAccessor>::get(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 // Note that this normally only sets the ID for a group the first time, unless | 34 // Note that this normally only sets the ID for a group the first time, unless |
| 35 // |force| is set to true, in which case it will always override it. | 35 // |force| is set to true, in which case it will always override it. |
| 36 void AssociateID(IDCollectionKey key, | 36 void AssociateID(IDCollectionKey key, |
| 37 const ActiveGroupId& group_identifier, | 37 const ActiveGroupId& group_identifier, |
| 38 const VariationID id, | 38 const VariationID id, |
| 39 const bool force) { | 39 const bool force) { |
| 40 #if !defined(NDEBUG) | 40 #if !defined(NDEBUG) |
| 41 DCHECK_EQ(4, ID_COLLECTION_COUNT); | 41 DCHECK_EQ(3, ID_COLLECTION_COUNT); |
| 42 // Ensure that at most one of the trigger/non-trigger web property IDs are | 42 // Ensure that at most one of the trigger/non-trigger web property IDs are |
| 43 // set. | 43 // set. |
| 44 if (key == GOOGLE_WEB_PROPERTIES || key == GOOGLE_WEB_PROPERTIES_TRIGGER) { | 44 if (key == GOOGLE_WEB_PROPERTIES || key == GOOGLE_WEB_PROPERTIES_TRIGGER) { |
| 45 IDCollectionKey other_key = key == GOOGLE_WEB_PROPERTIES ? | 45 IDCollectionKey other_key = key == GOOGLE_WEB_PROPERTIES ? |
| 46 GOOGLE_WEB_PROPERTIES_TRIGGER : GOOGLE_WEB_PROPERTIES; | 46 GOOGLE_WEB_PROPERTIES_TRIGGER : GOOGLE_WEB_PROPERTIES; |
| 47 DCHECK_EQ(EMPTY_ID, GetID(other_key, group_identifier)); | 47 DCHECK_EQ(EMPTY_ID, GetID(other_key, group_identifier)); |
| 48 } | 48 } |
| 49 | 49 |
| 50 // Validate that all collections with this |group_identifier| have the same | 50 // Validate that all collections with this |group_identifier| have the same |
| 51 // associated ID. | 51 // associated ID. |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 GroupMapAccessor::GetInstance()->ClearAllMapsForTesting(); | 280 GroupMapAccessor::GetInstance()->ClearAllMapsForTesting(); |
| 281 } | 281 } |
| 282 | 282 |
| 283 void ClearAllVariationParams() { | 283 void ClearAllVariationParams() { |
| 284 VariationsParamAssociator::GetInstance()->ClearAllParamsForTesting(); | 284 VariationsParamAssociator::GetInstance()->ClearAllParamsForTesting(); |
| 285 } | 285 } |
| 286 | 286 |
| 287 } // namespace testing | 287 } // namespace testing |
| 288 | 288 |
| 289 } // namespace variations | 289 } // namespace variations |
| OLD | NEW |