Chromium Code Reviews| 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..171ef8ed8d4e2509f5c2b52372f6b67ae21a8ec9 100644 |
| --- a/sync/internal_api/public/base/invalidation.h |
| +++ b/sync/internal_api/public/base/invalidation.h |
| @@ -7,25 +7,34 @@ |
| #include <string> |
| +#include "base/basictypes.h" |
| #include "base/memory/scoped_ptr.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(); |
| + |
|
akalin
2012/11/28 00:11:42
comment somewhere that default constructor creates
dcheng
2012/11/30 01:42:54
There is no default constructor =)
akalin
2012/11/30 02:45:15
isn't there an implicit one? or does the private
dcheng
2012/11/30 02:48:30
We define a constructor which suppress the generat
|
| 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); |
| - bool ResetFromValue(const base::Value& value); |
| + std::string state_; |
| }; |
| // Represents a local invalidation, and is roughly analogous to |
| @@ -34,15 +43,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 |