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

Side by Side Diff: sync/notifier/ordered_invalidation_list.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_INTERNAL_API_PUBLIC_BASE_INVALIDATION_LIST_H_
6 #define SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_LIST_H_
7
8 #include <set>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "sync/base/sync_export.h"
12 #include "sync/internal_api/public/base/invalidation.h"
13 #include "sync/notifier/invalidation_util.h"
14
15 namespace base {
16 class ListValue;
17 } // namespace base
18
19 namespace syncer {
20
21 // Holds a list of invalidations that all share the same Object ID.
22 //
23 // The list is kept sorted by version to make it easier to perform common
24 // operations, like checking for an unknown version invalidation or fetching the
25 // highest invalidation with the highest version number.
26 class SYNC_EXPORT OrderedInvalidationList {
27 public:
28 typedef std::set<Invalidation, InvalidationVersionLessThan> InvalidationsSet;
29 typedef InvalidationsSet::const_iterator const_iterator;
30 typedef InvalidationsSet::const_reverse_iterator const_reverse_iterator;
31
32 OrderedInvalidationList();
33 ~OrderedInvalidationList();
34
35 void Insert(const Invalidation& invalidation);
36 void InsertAll(const OrderedInvalidationList& other);
37 void Clear();
38
39 // Returns true if this list contains an unknown version.
40 //
41 // Unknown version invalidations always end up at the start of the list,
42 // because they have the lowest possible value in the sort ordering.
43 bool StartsWithUnknownVersion() const;
44 size_t GetSize() const;
45 bool IsEmpty() const;
46 bool operator==(const OrderedInvalidationList& other) const;
47
48 const_iterator begin() const;
49 const_iterator end() const;
50 const_reverse_iterator rbegin() const;
51 const_reverse_iterator rend() const;
52 const Invalidation& back() const;
53
54 scoped_ptr<base::ListValue> ToValue() const;
55 bool ResetFromValue(const base::ListValue& list);
56
57 private:
58 InvalidationsSet invalidations_;
59 };
60
61 } // syncer
62
63 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_LIST_H_
OLDNEW
« no previous file with comments | « sync/notifier/object_id_invalidation_map_test_util.cc ('k') | sync/notifier/ordered_invalidation_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698