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

Unified Diff: sync/notifier/invalidation_state_tracker.h

Issue 10911084: Implement Invalidator::Acknowledge (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Restart test + more cleanup Created 8 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/invalidation_state_tracker.h
diff --git a/sync/notifier/invalidation_state_tracker.h b/sync/notifier/invalidation_state_tracker.h
index 554114280f1196d889a31bd8617d206555876299..0f033080357612afe89b64ada03c63ee1f30b431 100644
--- a/sync/notifier/invalidation_state_tracker.h
+++ b/sync/notifier/invalidation_state_tracker.h
@@ -2,28 +2,49 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// An InvalidationVersionTracker is an interface that handles getting
-// and setting (persisting) max invalidation versions.
+// An InvalidationStateTracker is an interface that handles getting
+// and setting (persisting) max invalidation versions and our local ack
+// handles.
#ifndef SYNC_NOTIFIER_INVALIDATION_STATE_TRACKER_H_
#define SYNC_NOTIFIER_INVALIDATION_STATE_TRACKER_H_
+#include <string>
#include <map>
#include "base/basictypes.h"
+#include "base/callback_forward.h"
+#include "base/memory/ref_counted.h"
#include "google/cacheinvalidation/include/types.h"
+#include "sync/internal_api/public/base/invalidation.h"
#include "sync/notifier/invalidation_util.h"
+namespace base {
+class TaskRunner;
+} // namespace base
+
namespace syncer {
-typedef std::map<invalidation::ObjectId, int64, ObjectIdLessThan>
- InvalidationVersionMap;
+// TODO(dcheng): Need a better name.
akalin 2012/10/19 13:27:16 may want to have a separate smaller CL to add the
dcheng 2012/10/19 19:38:11 Sure, I'll pull this out into a separate CL.
+struct LocalState {
akalin 2012/10/19 13:27:16 i think since all the other "state" vars have been
dcheng 2012/10/19 19:38:11 Done.
+ LocalState();
+ ~LocalState();
+
+ int64 version;
+ AckHandle expected;
+ AckHandle current;
+};
+
+typedef std::map<invalidation::ObjectId, LocalState, ObjectIdLessThan>
+ InvalidationStateMap;
+typedef std::map<invalidation::ObjectId, AckHandle, ObjectIdLessThan>
+ AckHandleMap;
class InvalidationStateTracker {
public:
InvalidationStateTracker() {}
- virtual InvalidationVersionMap GetAllMaxVersions() const = 0;
+ virtual InvalidationStateMap GetStateMap() const = 0;
akalin 2012/10/19 13:27:16 perhaps GetAllInvalidationStates()?
dcheng 2012/10/19 19:38:11 Done.
// |max_version| should be strictly greater than any existing max
// version for |model_type|.
@@ -39,6 +60,16 @@ class InvalidationStateTracker {
virtual void SetBootstrapData(const std::string& data) = 0;
virtual std::string GetBootstrapData() const = 0;
+ // Used for generating our own local ack handles. Generates a new ack handle
+ // for each object id in |ids|. The result is returned via |callback| posted
+ // to |task_runner|.
+ virtual void GenerateAckHandles(
+ const ObjectIdSet& ids,
+ const scoped_refptr<base::TaskRunner>& task_runner,
+ base::Callback<void(const AckHandleMap&)> callback) = 0;
+ virtual void Acknowledge(const invalidation::ObjectId& id,
+ const AckHandle& ack_handle) = 0;
+
protected:
virtual ~InvalidationStateTracker() {}
};

Powered by Google App Engine
This is Rietveld 408576698