OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef SYNC_NOTIFIER_DROPPED_INVALIDATION_TRACKER_H_ | |
6 #define SYNC_NOTIFIER_DROPPED_INVALIDATION_TRACKER_H_ | |
7 | |
8 #include "google/cacheinvalidation/include/types.h" | |
9 #include "sync/base/sync_export.h" | |
10 #include "sync/internal_api/public/base/ack_handle.h" | |
11 #include "sync/internal_api/public/util/weak_handle.h" | |
12 #include "sync/notifier/ack_handler.h" | |
13 | |
14 namespace syncer { | |
15 | |
16 class Invalidation; | |
17 | |
18 // Helps InvalidationHandlers keep track of dropped invalidations for a given | |
19 // ObjectId. | |
20 // | |
21 // The intent of this class is to hide some of the implementation details around | |
22 // how the invalidations system manages dropping and drop recovery. Any | |
23 // invalidation handler that intends to buffer and occasionally drop | |
24 // invalidations should keep one instance of it per registered ObjectId. | |
25 // | |
26 // When an invalidation handler wishes to drop an invalidation, it must provide | |
27 // an instance of this class to that Invalidation's Drop() method. In order to | |
28 // indicate recovery from a drop, the handler can call this class' | |
29 // RecordRecoveryFromDropEvent(). | |
30 class SYNC_EXPORT DroppedInvalidationTracker { | |
rlarocque
2013/10/24 21:09:29
The DroppedInvalidationTracker is left over from a
| |
31 public: | |
32 DroppedInvalidationTracker(const invalidation::ObjectId& id); | |
tim (not reviewing)
2013/10/29 17:21:57
make constructor explicit.
rlarocque
2013/10/30 00:49:26
Done.
| |
33 ~DroppedInvalidationTracker(); | |
34 | |
35 const invalidation::ObjectId& object_id() const; | |
36 | |
37 // Called by Invalidation::Drop() to keep track of a drop event. | |
38 void RecordDropEvent(WeakHandle<AckHandler> handler, AckHandle handle); | |
tim (not reviewing)
2013/10/29 17:21:57
Comment on threading and where the best-effort con
rlarocque
2013/10/30 00:49:26
Added comment to the member variable.
| |
39 | |
40 // Returns true if we're still recovering from a drop event. | |
41 bool IsRecoveringFromDropEvent() const; | |
42 | |
43 // Called by the InvalidationHandler when it recovers from the drop event. | |
44 void RecordRecoveryFromDropEvent(); | |
45 | |
46 private: | |
47 invalidation::ObjectId id_; | |
48 AckHandle drop_ack_handle_; | |
49 WeakHandle<AckHandler> drop_ack_handler_; | |
50 | |
51 DISALLOW_COPY_AND_ASSIGN(DroppedInvalidationTracker); | |
52 }; | |
53 | |
54 } // namespace syncer | |
55 | |
56 #endif // SYNC_NOTIFIER_DROPPED_INVALIDATION_TRACKER_H_ | |
OLD | NEW |