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

Unified Diff: sync/notifier/dropped_invalidation_tracker.cc

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
Index: sync/notifier/dropped_invalidation_tracker.cc
diff --git a/sync/notifier/dropped_invalidation_tracker.cc b/sync/notifier/dropped_invalidation_tracker.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8599cc258c0c9e8c0583baf812481225f53ebd52
--- /dev/null
+++ b/sync/notifier/dropped_invalidation_tracker.cc
@@ -0,0 +1,42 @@
+// 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.
+
+#include "sync/notifier/dropped_invalidation_tracker.h"
+
+#include "sync/internal_api/public/base/invalidation.h"
+
+namespace syncer {
+
+DroppedInvalidationTracker::DroppedInvalidationTracker(
+ const invalidation::ObjectId& id)
+ : id_(id),
+ drop_ack_handle_(AckHandle::InvalidAckHandle()) {}
+
+DroppedInvalidationTracker::~DroppedInvalidationTracker() {}
+
+const invalidation::ObjectId& DroppedInvalidationTracker::object_id() const {
+ return id_;
+}
+
+void DroppedInvalidationTracker::RecordDropEvent(
+ WeakHandle<AckHandler> handler, AckHandle handle) {
+ drop_ack_handler_ = handler;
+ drop_ack_handle_ = handle;
+}
+
+void DroppedInvalidationTracker::RecordRecoveryFromDropEvent() {
+ if (drop_ack_handler_.IsInitialized()) {
+ drop_ack_handler_.Call(FROM_HERE,
+ &AckHandler::Acknowledge,
+ id_,
+ drop_ack_handle_);
+ }
+ drop_ack_handler_ = syncer::WeakHandle<AckHandler>();
+}
+
+bool DroppedInvalidationTracker::IsRecoveringFromDropEvent() const {
+ return drop_ack_handler_.IsInitialized();
+}
+
+} // namespace syncer

Powered by Google App Engine
This is Rietveld 408576698