OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 COMPONENTS_INVALIDATION_INVALIDATION_H_ |
6 #define SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_H_ | 6 #define COMPONENTS_INVALIDATION_INVALIDATION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "components/invalidation/ack_handle.h" |
| 14 #include "components/invalidation/invalidation_export.h" |
13 #include "google/cacheinvalidation/include/types.h" | 15 #include "google/cacheinvalidation/include/types.h" |
14 #include "sync/base/sync_export.h" | |
15 #include "sync/internal_api/public/base/ack_handle.h" | |
16 #include "sync/internal_api/public/util/weak_handle.h" | 16 #include "sync/internal_api/public/util/weak_handle.h" |
17 | 17 |
18 namespace syncer { | 18 namespace syncer { |
19 | 19 |
20 class DroppedInvalidationTracker; | 20 class DroppedInvalidationTracker; |
21 class AckHandler; | 21 class AckHandler; |
22 | 22 |
23 // Represents a local invalidation, and is roughly analogous to | 23 // Represents a local invalidation, and is roughly analogous to |
24 // invalidation::Invalidation. Unlike invalidation::Invalidation, this class | 24 // invalidation::Invalidation. Unlike invalidation::Invalidation, this class |
25 // supports "local" ack-tracking and simple serialization to pref values. | 25 // supports "local" ack-tracking and simple serialization to pref values. |
26 class SYNC_EXPORT Invalidation { | 26 class INVALIDATION_EXPORT Invalidation { |
27 public: | 27 public: |
28 // Factory functions. | 28 // Factory functions. |
29 static Invalidation Init( | 29 static Invalidation Init(const invalidation::ObjectId& id, |
30 const invalidation::ObjectId& id, | 30 int64 version, |
31 int64 version, | 31 const std::string& payload); |
32 const std::string& payload); | |
33 static Invalidation InitUnknownVersion(const invalidation::ObjectId& id); | 32 static Invalidation InitUnknownVersion(const invalidation::ObjectId& id); |
34 static Invalidation InitFromDroppedInvalidation(const Invalidation& dropped); | 33 static Invalidation InitFromDroppedInvalidation(const Invalidation& dropped); |
35 static scoped_ptr<Invalidation> InitFromValue( | 34 static scoped_ptr<Invalidation> InitFromValue( |
36 const base::DictionaryValue& value); | 35 const base::DictionaryValue& value); |
37 | 36 |
38 ~Invalidation(); | 37 ~Invalidation(); |
39 | 38 |
40 // Compares two invalidations. The comparison ignores ack-tracking state. | 39 // Compares two invalidations. The comparison ignores ack-tracking state. |
41 bool Equals(const Invalidation& other) const; | 40 bool Equals(const Invalidation& other) const; |
42 | 41 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // this is an unknown version invalidation. | 111 // this is an unknown version invalidation. |
113 std::string payload_; | 112 std::string payload_; |
114 | 113 |
115 // A locally generated unique ID used to manage local acknowledgements. | 114 // A locally generated unique ID used to manage local acknowledgements. |
116 AckHandle ack_handle_; | 115 AckHandle ack_handle_; |
117 syncer::WeakHandle<AckHandler> ack_handler_; | 116 syncer::WeakHandle<AckHandler> ack_handler_; |
118 }; | 117 }; |
119 | 118 |
120 } // namespace syncer | 119 } // namespace syncer |
121 | 120 |
122 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_H_ | 121 #endif // COMPONENTS_INVALIDATION_INVALIDATION_H_ |
OLD | NEW |