| 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 #ifndef SYNC_NOTIFIER_OBJECT_ID_INVALIDATION_MAP_H_ | 5 #ifndef SYNC_NOTIFIER_OBJECT_ID_INVALIDATION_MAP_H_ |
| 6 #define SYNC_NOTIFIER_OBJECT_ID_INVALIDATION_MAP_H_ | 6 #define SYNC_NOTIFIER_OBJECT_ID_INVALIDATION_MAP_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // whose IDs were in the specified |ids| set. | 42 // whose IDs were in the specified |ids| set. |
| 43 ObjectIdInvalidationMap GetSubsetWithObjectIds(const ObjectIdSet& ids) const; | 43 ObjectIdInvalidationMap GetSubsetWithObjectIds(const ObjectIdSet& ids) const; |
| 44 | 44 |
| 45 // Returns the subset of invalidations with IDs matching |id|. | 45 // Returns the subset of invalidations with IDs matching |id|. |
| 46 const SingleObjectInvalidationSet& ForObject( | 46 const SingleObjectInvalidationSet& ForObject( |
| 47 invalidation::ObjectId id) const; | 47 invalidation::ObjectId id) const; |
| 48 | 48 |
| 49 // Returns the contents of this map in a single vector. | 49 // Returns the contents of this map in a single vector. |
| 50 void GetAllInvalidations(std::vector<syncer::Invalidation>* out) const; | 50 void GetAllInvalidations(std::vector<syncer::Invalidation>* out) const; |
| 51 | 51 |
| 52 // Call Acknowledge() on all contained Invalidations. |
| 53 void AcknowledgeAll() const; |
| 54 |
| 52 // Serialize this map to a value. | 55 // Serialize this map to a value. |
| 53 scoped_ptr<base::ListValue> ToValue() const; | 56 scoped_ptr<base::ListValue> ToValue() const; |
| 54 | 57 |
| 55 // Deserialize the value into a map and use it to re-initialize this object. | 58 // Deserialize the value into a map and use it to re-initialize this object. |
| 56 bool ResetFromValue(const base::ListValue& value); | 59 bool ResetFromValue(const base::ListValue& value); |
| 57 | 60 |
| 58 // Prints the contentes of this map as a human-readable string. | 61 // Prints the contentes of this map as a human-readable string. |
| 59 std::string ToString() const; | 62 std::string ToString() const; |
| 60 | 63 |
| 61 private: | 64 private: |
| 62 typedef std::map<invalidation::ObjectId, | 65 typedef std::map<invalidation::ObjectId, |
| 63 SingleObjectInvalidationSet, | 66 SingleObjectInvalidationSet, |
| 64 ObjectIdLessThan> IdToListMap; | 67 ObjectIdLessThan> IdToListMap; |
| 65 | 68 |
| 66 ObjectIdInvalidationMap(const IdToListMap& map); | 69 ObjectIdInvalidationMap(const IdToListMap& map); |
| 67 | 70 |
| 68 IdToListMap map_; | 71 IdToListMap map_; |
| 69 }; | 72 }; |
| 70 | 73 |
| 71 } // namespace syncer | 74 } // namespace syncer |
| 72 | 75 |
| 73 #endif // SYNC_NOTIFIER_OBJECT_ID_INVALIDATION_MAP_H_ | 76 #endif // SYNC_NOTIFIER_OBJECT_ID_INVALIDATION_MAP_H_ |
| OLD | NEW |