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

Side by Side Diff: sync/internal_api/public/base/invalidation.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_H_ 5 #ifndef SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_H_
6 #define SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_H_ 6 #define SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h"
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 12
12 namespace base { 13 namespace base {
13 class DictionaryValue; 14 class DictionaryValue;
14 class Value; 15 class Value;
15 } // namespace 16 } // namespace
16 17
17 namespace syncer { 18 namespace syncer {
18 19
19 // Opaque class that represents an ack handle. 20 // Opaque class that represents an ack handle. We don't reuse the Tango ack
akalin 2012/10/19 13:27:16 Tango -> invalidation::
dcheng 2012/10/19 19:38:11 Done.
20 // TODO(dcheng): This is just a refactoring change, so the class is empty for 21 // handles to avoid unnecessary dependencies.
21 // the moment. It will be filled once we start implementing 'reminders'.
22 class AckHandle { 22 class AckHandle {
23 public: 23 public:
24 static AckHandle CreateUnique();
25 static AckHandle InvalidAckHandle();
26
24 bool Equals(const AckHandle& other) const; 27 bool Equals(const AckHandle& other) const;
25 28
26 scoped_ptr<base::Value> ToValue() const; 29 scoped_ptr<base::Value> ToValue() const;
30 bool ResetFromValue(const base::Value& value);
akalin 2012/10/19 13:27:16 comment that copy constructor and assignment opera
dcheng 2012/10/19 19:38:11 Done. Unless I'm missing something, no default cto
27 31
28 bool ResetFromValue(const base::Value& value); 32 private:
33 AckHandle(const std::string& state);
34
35 std::string state_;
29 }; 36 };
30 37
31 // Represents a local invalidation, and is roughly analogous to 38 // Represents a local invalidation, and is roughly analogous to
32 // invalidation::Invalidation. It contains a payload (which may be empty) and an 39 // invalidation::Invalidation. It contains a payload (which may be empty) and an
33 // associated ack handle that an InvalidationHandler implementation can use to 40 // associated ack handle that an InvalidationHandler implementation can use to
34 // acknowledge receipt of the invalidation. It does not embed the object ID, 41 // acknowledge receipt of the invalidation. It does not embed the object ID,
35 // since it is typically associated with it through ObjectIdInvalidationMap. 42 // since it is typically associated with it through ObjectIdInvalidationMap.
36 struct Invalidation { 43 struct Invalidation {
37 std::string payload; 44 Invalidation();
38 AckHandle ack_handle;
39 45
40 bool Equals(const Invalidation& other) const; 46 bool Equals(const Invalidation& other) const;
41 47
42 // Caller owns the returned DictionaryValue.
43 scoped_ptr<base::DictionaryValue> ToValue() const; 48 scoped_ptr<base::DictionaryValue> ToValue() const;
49 bool ResetFromValue(const base::DictionaryValue& value);
44 50
45 bool ResetFromValue(const base::DictionaryValue& value); 51 std::string payload;
52 AckHandle ack_handle;
46 }; 53 };
47 54
48 } // namespace syncer 55 } // namespace syncer
49 56
50 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_H_ 57 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698