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

Unified Diff: sync/internal_api/public/base/invalidation.h

Issue 11415049: Implement features needed for local ack handling in InvalidationStateTracker. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ...... Created 8 years 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/internal_api/public/base/invalidation.h
diff --git a/sync/internal_api/public/base/invalidation.h b/sync/internal_api/public/base/invalidation.h
index fc8c361c65086da59befa034ddbfe1c72a7f1764..f25304b70d6425e7ee5736de79da78708cee3f75 100644
--- a/sync/internal_api/public/base/invalidation.h
+++ b/sync/internal_api/public/base/invalidation.h
@@ -7,25 +7,36 @@
#include <string>
+#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
+#include "base/time.h"
namespace base {
class DictionaryValue;
-class Value;
} // namespace
namespace syncer {
-// Opaque class that represents an ack handle.
-// TODO(dcheng): This is just a refactoring change, so the class is empty for
-// the moment. It will be filled once we start implementing 'reminders'.
+// Opaque class that represents a local ack handle. We don't reuse the
+// invalidation ack handles to avoid unnecessary dependencies.
class AckHandle {
public:
+ static AckHandle CreateUnique();
+ static AckHandle InvalidAckHandle();
+
bool Equals(const AckHandle& other) const;
- scoped_ptr<base::Value> ToValue() const;
+ scoped_ptr<base::DictionaryValue> ToValue() const;
+ bool ResetFromValue(const base::DictionaryValue& value);
+
+ bool IsValid() const;
+
+ private:
+ // Explicitly copyable and assignable for STL containers.
+ AckHandle(const std::string& state, base::Time timestamp);
- bool ResetFromValue(const base::Value& value);
+ std::string state_;
+ base::Time timestamp_;
};
// Represents a local invalidation, and is roughly analogous to
@@ -34,15 +45,15 @@ class AckHandle {
// acknowledge receipt of the invalidation. It does not embed the object ID,
// since it is typically associated with it through ObjectIdInvalidationMap.
struct Invalidation {
- std::string payload;
- AckHandle ack_handle;
+ Invalidation();
bool Equals(const Invalidation& other) const;
- // Caller owns the returned DictionaryValue.
scoped_ptr<base::DictionaryValue> ToValue() const;
-
bool ResetFromValue(const base::DictionaryValue& value);
+
+ std::string payload;
+ AckHandle ack_handle;
};
} // namespace syncer
« no previous file with comments | « chrome/browser/sync/invalidations/invalidator_storage_unittest.cc ('k') | sync/internal_api/public/base/invalidation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698