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

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: Review fixes 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
« no previous file with comments | « sync/notifier/ack_handler.cc ('k') | sync/notifier/dropped_invalidation_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..95993d62e2258f91453d8057a98c8ade6189e7cf
--- /dev/null
+++ b/sync/notifier/dropped_invalidation_tracker.h
@@ -0,0 +1,63 @@
+// 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 {
+ public:
+ explicit DroppedInvalidationTracker(const invalidation::ObjectId& id);
+ ~DroppedInvalidationTracker();
+
+ const invalidation::ObjectId& object_id() const;
+
+ // Called by Invalidation::Drop() to keep track of a drop event.
tim (not reviewing) 2013/10/30 02:03:07 Explain parameter or refer to comment at drop_ack_
+ void RecordDropEvent(WeakHandle<AckHandler> handler, AckHandle handle);
+
+ // 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_;
+
+ // A WeakHandle to the enitity responsible for persisting invalidation
+ // acknowledgement state on disk. We can get away with using a WeakHandle
+ // because we don't care if our drop recovery message doesn't gets delivered
+ // in some shutdown cases. If that happens, we'll have to process the
+ // invalidation state again on the next restart. It would be a waste of time
+ // and resources, but otherwise not particularly harmful.
+ WeakHandle<AckHandler> drop_ack_handler_;
+
+ DISALLOW_COPY_AND_ASSIGN(DroppedInvalidationTracker);
+};
+
+} // namespace syncer
+
+#endif // SYNC_NOTIFIER_DROPPED_INVALIDATION_TRACKER_H_
« no previous file with comments | « sync/notifier/ack_handler.cc ('k') | sync/notifier/dropped_invalidation_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698