| OLD | NEW |
| 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 #ifndef SYNC_NOTIFIER_OBJECT_ID_STATE_MAP_H_ | 5 #ifndef SYNC_NOTIFIER_OBJECT_ID_STATE_MAP_H_ |
| 6 #define SYNC_NOTIFIER_OBJECT_ID_STATE_MAP_H_ | 6 #define SYNC_NOTIFIER_OBJECT_ID_STATE_MAP_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "google/cacheinvalidation/include/types.h" | 11 #include "google/cacheinvalidation/include/types.h" |
| 12 #include "sync/internal_api/public/base/invalidation_state.h" | 12 #include "sync/internal_api/public/base/invalidation_state.h" |
| 13 #include "sync/internal_api/public/base/model_type_state_map.h" | 13 #include "sync/internal_api/public/base/model_type_state_map.h" |
| 14 #include "sync/notifier/invalidation_util.h" | 14 #include "sync/notifier/invalidation_util.h" |
| 15 | 15 |
| 16 namespace base { |
| 17 class ListValue; |
| 18 } // namespace base |
| 19 |
| 16 namespace syncer { | 20 namespace syncer { |
| 17 | 21 |
| 18 typedef std::map<invalidation::ObjectId, | 22 typedef std::map<invalidation::ObjectId, |
| 19 InvalidationState, | 23 InvalidationState, |
| 20 ObjectIdLessThan> ObjectIdStateMap; | 24 ObjectIdLessThan> ObjectIdStateMap; |
| 21 | 25 |
| 22 // Converts between ObjectIdStateMaps and ObjectIdSets. | 26 // Converts between ObjectIdStateMaps and ObjectIdSets. |
| 23 ObjectIdSet ObjectIdStateMapToSet(const ObjectIdStateMap& id_payloads); | 27 ObjectIdSet ObjectIdStateMapToSet(const ObjectIdStateMap& id_payloads); |
| 24 ObjectIdStateMap ObjectIdSetToStateMap(const ObjectIdSet& ids, | 28 ObjectIdStateMap ObjectIdSetToStateMap(const ObjectIdSet& ids, |
| 25 const std::string& payload); | 29 const std::string& payload); |
| 26 | 30 |
| 31 bool ObjectIdStateMapEquals(const ObjectIdStateMap& id_state_map1, |
| 32 const ObjectIdStateMap& id_state_map2); |
| 33 |
| 34 // Caller takes ownership of the returned dictionary. |
| 35 base::ListValue* ObjectIdStateMapToValue( |
| 36 const ObjectIdStateMap& model_type_payloads); |
| 37 |
| 38 bool ObjectIdStateMapFromValue(const base::ListValue& value, |
| 39 ObjectIdStateMap* out); |
| 40 |
| 27 // Converts between ObjectIdStateMaps and ModelTypeStateMaps. | 41 // Converts between ObjectIdStateMaps and ModelTypeStateMaps. |
| 28 ModelTypeStateMap ObjectIdStateMapToModelTypeStateMap( | 42 ModelTypeStateMap ObjectIdStateMapToModelTypeStateMap( |
| 29 const ObjectIdStateMap& id_payloads); | 43 const ObjectIdStateMap& id_payloads); |
| 30 ObjectIdStateMap ModelTypeStateMapToObjectIdStateMap( | 44 ObjectIdStateMap ModelTypeStateMapToObjectIdStateMap( |
| 31 const ModelTypeStateMap& type_payloads); | 45 const ModelTypeStateMap& type_payloads); |
| 32 | 46 |
| 33 } // namespace syncer | 47 } // namespace syncer |
| 34 | 48 |
| 35 #endif // HOME_DCHENG_SRC_CHROMIUM_SRC_SYNC_NOTIFIER_OBJECT_ID_STATE_MAP_H_ | 49 #endif // HOME_DCHENG_SRC_CHROMIUM_SRC_SYNC_NOTIFIER_OBJECT_ID_STATE_MAP_H_ |
| OLD | NEW |