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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/notifier/unacked_invalidation_storage.h
diff --git a/sync/notifier/unacked_invalidation_storage.h b/sync/notifier/unacked_invalidation_storage.h
new file mode 100644
index 0000000000000000000000000000000000000000..915cb79035b35fc98b2d02367fc93c70dec9f57d
--- /dev/null
+++ b/sync/notifier/unacked_invalidation_storage.h
@@ -0,0 +1,64 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SYNC_NOTIFIER_UNACKED_INVALIDATION_STORAGE_H_
+#define SYNC_NOTIFIER_UNACKED_INVALIDATION_STORAGE_H_
+
+#include <vector>
+
+#include "sync/internal_api/public/base/invalidation.h"
+#include "sync/internal_api/public/util/weak_handle.h"
+#include "sync/notifier/invalidation_util.h"
+
+namespace base {
+class DictionaryValue;
+} // namespace base
+
+namespace syncer {
+
+class OrderedInvalidationList;
+class ObjectIdInvalidationMap;
+class AckHandle;
+
+class SYNC_EXPORT UnackedInvalidationStorage {
+ public:
+ UnackedInvalidationStorage(invalidation::ObjectId id);
+ ~UnackedInvalidationStorage();
+
+ bool ResetFromValue(const base::DictionaryValue& value);
+
+ const invalidation::ObjectId& GetObjectId() const;
+
+ void RecordInvalidation(const Invalidation& invalidation);
+ void RecordInvalidations(const OrderedInvalidationList& invalidations);
+ void UnpackRecordedInvalidations(ObjectIdInvalidationMap* out,
+ WeakHandle<AckHandler> ack_handler) const;
+ void Clear();
+
+ void SetIsRegistered();
+ void UnsetIsRegistered();
+
+ void Acknowledge(const AckHandle& handle);
+ void Drop(const AckHandle& handle);
+
+ scoped_ptr<base::DictionaryValue> ToValue() const;
+
+ private:
+ typedef std::set<Invalidation, InvalidationVersionLessThan> InvalidationsSet;
+
+ void Truncate(size_t max_size);
+ bool ResetListFromValue(const base::ListValue& value);
+
+ bool registered_;
+ invalidation::ObjectId object_id_;
+ InvalidationsSet invalidations_;
+};
+
+typedef std::map<invalidation::ObjectId,
+ UnackedInvalidationStorage,
+ ObjectIdLessThan> UnackedInvalidationStorageMap;
+
+} // namespace syncer
+
+#endif // SYNC_NOTIFIER_UNACKED_INVALIDATION_STORAGE_H_
« 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