OLD | NEW |
---|---|
1 // Copyright 2012 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 <string> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "google/cacheinvalidation/include/types.h" | |
14 #include "sync/base/sync_export.h" | 11 #include "sync/base/sync_export.h" |
15 #include "sync/internal_api/public/base/invalidation.h" | 12 #include "sync/internal_api/public/base/invalidation.h" |
16 #include "sync/notifier/invalidation_util.h" | 13 #include "sync/notifier/invalidation_util.h" |
17 | 14 #include "sync/notifier/ordered_invalidation_list.h" |
18 namespace base { | |
19 class ListValue; | |
20 } // namespace base | |
21 | 15 |
22 namespace syncer { | 16 namespace syncer { |
23 | 17 |
24 typedef std::map<invalidation::ObjectId, | 18 class SYNC_EXPORT ObjectIdInvalidationMap { |
tim (not reviewing)
2013/09/20 21:53:46
What is this class supposed to do? Looking at it
rlarocque
2013/09/23 18:38:19
This class is supposed to be a container for many
tim (not reviewing)
2013/09/24 21:16:54
I see. So it's returning a subset / projection of
rlarocque
2013/09/25 00:40:00
GetSubsetWithObjectIds() makes sense to me.
| |
25 Invalidation, | 19 public: |
26 ObjectIdLessThan> ObjectIdInvalidationMap; | 20 static ObjectIdInvalidationMap InvalidateAll(const ObjectIdSet& ids); |
27 | 21 |
28 // Converts between ObjectIdInvalidationMaps and ObjectIdSets. | 22 ObjectIdInvalidationMap(); |
29 ObjectIdSet ObjectIdInvalidationMapToSet( | 23 ~ObjectIdInvalidationMap(); |
30 const ObjectIdInvalidationMap& invalidation_map); | |
31 SYNC_EXPORT ObjectIdInvalidationMap ObjectIdSetToInvalidationMap( | |
32 const ObjectIdSet& ids, int64 version, const std::string& payload); | |
33 | 24 |
34 SYNC_EXPORT bool ObjectIdInvalidationMapEquals( | 25 ObjectIdSet GetObjectIds() const; |
35 const ObjectIdInvalidationMap& invalidation_map1, | 26 bool Empty() const; |
36 const ObjectIdInvalidationMap& invalidation_map2); | 27 bool operator==(const ObjectIdInvalidationMap& other) const; |
37 | 28 |
38 scoped_ptr<base::ListValue> ObjectIdInvalidationMapToValue( | 29 void Insert(const Invalidation& invalidation); |
39 const ObjectIdInvalidationMap& invalidation_map); | |
40 | 30 |
41 bool ObjectIdInvalidationMapFromValue(const base::ListValue& value, | 31 ObjectIdInvalidationMap WithObjects(const ObjectIdSet& ids) const; |
tim (not reviewing)
2013/09/20 21:53:46
Are there any basic tests for this filtering?
rlarocque
2013/09/23 18:38:19
No, there are no tests for any part of this class.
tim (not reviewing)
2013/09/24 21:16:54
Great!
| |
42 ObjectIdInvalidationMap* out); | 32 const OrderedInvalidationList& ForObject(invalidation::ObjectId id) const; |
33 void GetAllInvalidations(std::vector<syncer::Invalidation>* out) const; | |
34 | |
35 scoped_ptr<base::ListValue> ToValue() const; | |
36 bool ResetFromValue(const base::ListValue& value); | |
37 | |
38 std::string ToString() const; | |
39 | |
40 private: | |
41 typedef std::map<invalidation::ObjectId, | |
42 OrderedInvalidationList, | |
43 ObjectIdLessThan> IdToListMap; | |
44 | |
45 ObjectIdInvalidationMap(const IdToListMap& map); | |
46 | |
47 IdToListMap map_; | |
48 }; | |
43 | 49 |
44 } // namespace syncer | 50 } // namespace syncer |
45 | 51 |
46 #endif // SYNC_NOTIFIER_OBJECT_ID_INVALIDATION_MAP_H_ | 52 #endif // SYNC_NOTIFIER_OBJECT_ID_INVALIDATION_MAP_H_ |
OLD | NEW |