OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_INVALIDATION_UNACKED_INVALIDATION_SET_H_ | 5 #ifndef COMPONENTS_INVALIDATION_UNACKED_INVALIDATION_SET_H_ |
6 #define COMPONENTS_INVALIDATION_UNACKED_INVALIDATION_SET_H_ | 6 #define COMPONENTS_INVALIDATION_UNACKED_INVALIDATION_SET_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
| 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/single_thread_task_runner.h" |
10 #include "components/invalidation/invalidation.h" | 12 #include "components/invalidation/invalidation.h" |
11 #include "components/invalidation/invalidation_export.h" | 13 #include "components/invalidation/invalidation_export.h" |
12 #include "components/invalidation/invalidation_util.h" | 14 #include "components/invalidation/invalidation_util.h" |
13 #include "sync/internal_api/public/util/weak_handle.h" | |
14 | 15 |
15 namespace base { | 16 namespace base { |
16 class DictionaryValue; | 17 class DictionaryValue; |
17 } // namespace base | 18 } // namespace base |
18 | 19 |
19 namespace syncer { | 20 namespace syncer { |
20 | 21 |
21 namespace test_util { | 22 namespace test_util { |
22 class UnackedInvalidationSetEqMatcher; | 23 class UnackedInvalidationSetEqMatcher; |
23 } // test_util | 24 } // test_util |
(...skipping 22 matching lines...) Expand all Loading... |
46 // Adds many new invalidations to the set awaiting acknowledgement. | 47 // Adds many new invalidations to the set awaiting acknowledgement. |
47 void AddSet(const SingleObjectInvalidationSet& invalidations); | 48 void AddSet(const SingleObjectInvalidationSet& invalidations); |
48 | 49 |
49 // Exports the set of invalidations awaiting acknowledgement as an | 50 // Exports the set of invalidations awaiting acknowledgement as an |
50 // ObjectIdInvalidationMap. Each of these invalidations will be associated | 51 // ObjectIdInvalidationMap. Each of these invalidations will be associated |
51 // with the given |ack_handler|. | 52 // with the given |ack_handler|. |
52 // | 53 // |
53 // The contents of the UnackedInvalidationSet are not directly modified by | 54 // The contents of the UnackedInvalidationSet are not directly modified by |
54 // this procedure, but the AckHandles stored in those exported invalidations | 55 // this procedure, but the AckHandles stored in those exported invalidations |
55 // are likely to end up back here in calls to Acknowledge() or Drop(). | 56 // are likely to end up back here in calls to Acknowledge() or Drop(). |
56 void ExportInvalidations(WeakHandle<AckHandler> ack_handler, | 57 void ExportInvalidations( |
57 ObjectIdInvalidationMap* out) const; | 58 base::WeakPtr<AckHandler> ack_handler, |
| 59 scoped_refptr<base::SingleThreadTaskRunner> ack_handler_task_runner, |
| 60 ObjectIdInvalidationMap* out) const; |
58 | 61 |
59 // Removes all stored invalidations from this object. | 62 // Removes all stored invalidations from this object. |
60 void Clear(); | 63 void Clear(); |
61 | 64 |
62 // Indicates that a handler has registered to handle these invalidations. | 65 // Indicates that a handler has registered to handle these invalidations. |
63 // | 66 // |
64 // Registrations with the invalidations server persist across restarts, but | 67 // Registrations with the invalidations server persist across restarts, but |
65 // registrations from InvalidationHandlers to the InvalidationService are not. | 68 // registrations from InvalidationHandlers to the InvalidationService are not. |
66 // In the time immediately after a restart, it's possible that the server | 69 // In the time immediately after a restart, it's possible that the server |
67 // will send us invalidations, and we won't have a handler to send them to. | 70 // will send us invalidations, and we won't have a handler to send them to. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 InvalidationsSet invalidations_; | 112 InvalidationsSet invalidations_; |
110 }; | 113 }; |
111 | 114 |
112 typedef std::map<invalidation::ObjectId, | 115 typedef std::map<invalidation::ObjectId, |
113 UnackedInvalidationSet, | 116 UnackedInvalidationSet, |
114 ObjectIdLessThan> UnackedInvalidationsMap; | 117 ObjectIdLessThan> UnackedInvalidationsMap; |
115 | 118 |
116 } // namespace syncer | 119 } // namespace syncer |
117 | 120 |
118 #endif // COMPONENTS_INVALIDATION_UNACKED_INVALIDATION_SET_H_ | 121 #endif // COMPONENTS_INVALIDATION_UNACKED_INVALIDATION_SET_H_ |
OLD | NEW |