Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: sync/notifier/unacked_invalidation_set.h

Issue 56113003: Implement new invalidations ack tracking system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Modify drive TODO comment + rebase Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_UNACKED_INVALIDATION_SET_H_ 5 #ifndef SYNC_NOTIFIER_UNACKED_INVALIDATION_SET_H_
6 #define SYNC_NOTIFIER_UNACKED_INVALIDATION_SET_H_ 6 #define SYNC_NOTIFIER_UNACKED_INVALIDATION_SET_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "sync/base/sync_export.h" 10 #include "sync/base/sync_export.h"
11 #include "sync/internal_api/public/base/invalidation.h" 11 #include "sync/internal_api/public/base/invalidation.h"
12 #include "sync/internal_api/public/util/weak_handle.h" 12 #include "sync/internal_api/public/util/weak_handle.h"
13 #include "sync/notifier/invalidation_util.h" 13 #include "sync/notifier/invalidation_util.h"
14 14
15 namespace base { 15 namespace base {
16 class DictionaryValue; 16 class DictionaryValue;
17 } // namespace base 17 } // namespace base
18 18
19 namespace syncer { 19 namespace syncer {
20 20
21 namespace test_util {
22 class UnackedInvalidationSetEqMatcher;
23 } // test_util
24
21 class SingleObjectInvalidationSet; 25 class SingleObjectInvalidationSet;
22 class ObjectIdInvalidationMap; 26 class ObjectIdInvalidationMap;
23 class AckHandle; 27 class AckHandle;
24 28
25 // Manages the set of invalidations that are awaiting local acknowledgement for 29 // Manages the set of invalidations that are awaiting local acknowledgement for
26 // a particular ObjectId. This set of invalidations will be persisted across 30 // a particular ObjectId. This set of invalidations will be persisted across
27 // restarts, though this class is not directly responsible for that. 31 // restarts, though this class is not directly responsible for that.
28 class SYNC_EXPORT UnackedInvalidationSet { 32 class SYNC_EXPORT UnackedInvalidationSet {
29 public: 33 public:
30 static const size_t kMaxBufferedInvalidations; 34 static const size_t kMaxBufferedInvalidations;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // Given an AckHandle belonging to one of the contained invalidations, finds 85 // Given an AckHandle belonging to one of the contained invalidations, finds
82 // the invalidation, drops it from the list, and adds additional state to 86 // the invalidation, drops it from the list, and adds additional state to
83 // indicate that this invalidation has been lost without being acted on. 87 // indicate that this invalidation has been lost without being acted on.
84 void Drop(const AckHandle& handle); 88 void Drop(const AckHandle& handle);
85 89
86 scoped_ptr<base::DictionaryValue> ToValue() const; 90 scoped_ptr<base::DictionaryValue> ToValue() const;
87 bool ResetFromValue(const base::DictionaryValue& value); 91 bool ResetFromValue(const base::DictionaryValue& value);
88 92
89 private: 93 private:
90 // Allow this test helper to have access to our internals. 94 // Allow this test helper to have access to our internals.
91 friend class UnackedInvalidationSetEqMatcher; 95 friend class test_util::UnackedInvalidationSetEqMatcher;
92 96
93 typedef std::set<Invalidation, InvalidationVersionLessThan> InvalidationsSet; 97 typedef std::set<Invalidation, InvalidationVersionLessThan> InvalidationsSet;
94 98
95 bool ResetListFromValue(const base::ListValue& value); 99 bool ResetListFromValue(const base::ListValue& value);
96 100
97 // Limits the list size to the given maximum. This function will correctly 101 // Limits the list size to the given maximum. This function will correctly
98 // update this class' internal data to indicate if invalidations have been 102 // update this class' internal data to indicate if invalidations have been
99 // dropped. 103 // dropped.
100 void Truncate(size_t max_size); 104 void Truncate(size_t max_size);
101 105
102 bool registered_; 106 bool registered_;
103 invalidation::ObjectId object_id_; 107 invalidation::ObjectId object_id_;
104 InvalidationsSet invalidations_; 108 InvalidationsSet invalidations_;
105 }; 109 };
106 110
107 typedef std::map<invalidation::ObjectId, 111 typedef std::map<invalidation::ObjectId,
108 UnackedInvalidationSet, 112 UnackedInvalidationSet,
109 ObjectIdLessThan> UnackedInvalidationsMap; 113 ObjectIdLessThan> UnackedInvalidationsMap;
110 114
111 } // namespace syncer 115 } // namespace syncer
112 116
113 #endif // SYNC_NOTIFIER_UNACKED_INVALIDATION_SET_H_ 117 #endif // SYNC_NOTIFIER_UNACKED_INVALIDATION_SET_H_
OLDNEW
« no previous file with comments | « sync/notifier/sync_invalidation_listener_unittest.cc ('k') | sync/notifier/unacked_invalidation_set_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698