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

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

Issue 23754021: Invalidation trickles mega-patch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months 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
(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_UNACKED_INVALIDATION_STORAGE_H_
6 #define SYNC_NOTIFIER_UNACKED_INVALIDATION_STORAGE_H_
7
8 #include <vector>
9
10 #include "sync/internal_api/public/base/invalidation.h"
11 #include "sync/internal_api/public/util/weak_handle.h"
12 #include "sync/notifier/invalidation_util.h"
13
14 namespace base {
15 class DictionaryValue;
16 } // namespace base
17
18 namespace syncer {
19
20 class OrderedInvalidationList;
21 class ObjectIdInvalidationMap;
22 class AckHandle;
23
24 class SYNC_EXPORT UnackedInvalidationStorage {
25 public:
26 UnackedInvalidationStorage(invalidation::ObjectId id);
27 ~UnackedInvalidationStorage();
28
29 bool ResetFromValue(const base::DictionaryValue& value);
30
31 const invalidation::ObjectId& GetObjectId() const;
32
33 void RecordInvalidation(const Invalidation& invalidation);
34 void RecordInvalidations(const OrderedInvalidationList& invalidations);
35 void UnpackRecordedInvalidations(ObjectIdInvalidationMap* out,
36 WeakHandle<AckHandler> ack_handler) const;
37 void Clear();
38
39 void SetIsRegistered();
40 void UnsetIsRegistered();
41
42 void Acknowledge(const AckHandle& handle);
43 void Drop(const AckHandle& handle);
44
45 scoped_ptr<base::DictionaryValue> ToValue() const;
46
47 private:
48 typedef std::set<Invalidation, InvalidationVersionLessThan> InvalidationsSet;
49
50 void Truncate(size_t max_size);
51 bool ResetListFromValue(const base::ListValue& value);
52
53 bool registered_;
54 invalidation::ObjectId object_id_;
55 InvalidationsSet invalidations_;
56 };
57
58 typedef std::map<invalidation::ObjectId,
59 UnackedInvalidationStorage,
60 ObjectIdLessThan> UnackedInvalidationStorageMap;
61
62 } // namespace syncer
63
64 #endif // SYNC_NOTIFIER_UNACKED_INVALIDATION_STORAGE_H_
OLDNEW
« no previous file with comments | « sync/notifier/sync_invalidation_listener_unittest.cc ('k') | sync/notifier/unacked_invalidation_storage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698