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

Unified Diff: sync/notifier/dropped_invalidation_tracker.h

Issue 40303005: Add code for new invalidation local ack system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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
Index: sync/notifier/dropped_invalidation_tracker.h
diff --git a/sync/notifier/dropped_invalidation_tracker.h b/sync/notifier/dropped_invalidation_tracker.h
new file mode 100644
index 0000000000000000000000000000000000000000..03f279d2546907bd8665dcd905a524f8e050b080
--- /dev/null
+++ b/sync/notifier/dropped_invalidation_tracker.h
@@ -0,0 +1,56 @@
+// 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_DROPPED_INVALIDATION_TRACKER_H_
+#define SYNC_NOTIFIER_DROPPED_INVALIDATION_TRACKER_H_
+
+#include "google/cacheinvalidation/include/types.h"
+#include "sync/base/sync_export.h"
+#include "sync/internal_api/public/base/ack_handle.h"
+#include "sync/internal_api/public/util/weak_handle.h"
+#include "sync/notifier/ack_handler.h"
+
+namespace syncer {
+
+class Invalidation;
+
+// Helps InvalidationHandlers keep track of dropped invalidations for a given
+// ObjectId.
+//
+// The intent of this class is to hide some of the implementation details around
+// how the invalidations system manages dropping and drop recovery. Any
+// invalidation handler that intends to buffer and occasionally drop
+// invalidations should keep one instance of it per registered ObjectId.
+//
+// When an invalidation handler wishes to drop an invalidation, it must provide
+// an instance of this class to that Invalidation's Drop() method. In order to
+// indicate recovery from a drop, the handler can call this class'
+// RecordRecoveryFromDropEvent().
+class SYNC_EXPORT DroppedInvalidationTracker {
rlarocque 2013/10/24 21:09:29 The DroppedInvalidationTracker is left over from a
+ public:
+ 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.
+ ~DroppedInvalidationTracker();
+
+ const invalidation::ObjectId& object_id() const;
+
+ // Called by Invalidation::Drop() to keep track of a drop event.
+ 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.
+
+ // Returns true if we're still recovering from a drop event.
+ bool IsRecoveringFromDropEvent() const;
+
+ // Called by the InvalidationHandler when it recovers from the drop event.
+ void RecordRecoveryFromDropEvent();
+
+ private:
+ invalidation::ObjectId id_;
+ AckHandle drop_ack_handle_;
+ WeakHandle<AckHandler> drop_ack_handler_;
+
+ DISALLOW_COPY_AND_ASSIGN(DroppedInvalidationTracker);
+};
+
+} // namespace syncer
+
+#endif // SYNC_NOTIFIER_DROPPED_INVALIDATION_TRACKER_H_

Powered by Google App Engine
This is Rietveld 408576698