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

Side by Side Diff: sync/internal_api/public/base/invalidation.h

Issue 322333004: sync: Inject sync/'s dependency on invalidations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 5 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
« no previous file with comments | « sync/engine/sync_scheduler_unittest.cc ('k') | sync/internal_api/public/base/invalidation.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 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/basictypes.h"
(...skipping 17 matching lines...) Expand all
28 // Factory functions. 28 // Factory functions.
29 static Invalidation Init( 29 static Invalidation Init(
30 const invalidation::ObjectId& id, 30 const invalidation::ObjectId& id,
31 int64 version, 31 int64 version,
32 const std::string& payload); 32 const std::string& payload);
33 static Invalidation InitUnknownVersion(const invalidation::ObjectId& id); 33 static Invalidation InitUnknownVersion(const invalidation::ObjectId& id);
34 static Invalidation InitFromDroppedInvalidation(const Invalidation& dropped); 34 static Invalidation InitFromDroppedInvalidation(const Invalidation& dropped);
35 static scoped_ptr<Invalidation> InitFromValue( 35 static scoped_ptr<Invalidation> InitFromValue(
36 const base::DictionaryValue& value); 36 const base::DictionaryValue& value);
37 37
38 Invalidation(const Invalidation& other);
38 ~Invalidation(); 39 ~Invalidation();
39 40
40 // Compares two invalidations. The comparison ignores ack-tracking state. 41 // Compares two invalidations. The comparison ignores ack-tracking state.
41 bool Equals(const Invalidation& other) const; 42 bool Equals(const Invalidation& other) const;
42 43
43 invalidation::ObjectId object_id() const; 44 invalidation::ObjectId object_id() const;
44 bool is_unknown_version() const; 45 bool is_unknown_version() const;
45 46
46 // Safe to call only if is_unknown_version() returns false. 47 // Safe to call only if is_unknown_version() returns false.
47 int64 version() const; 48 int64 version() const;
(...skipping 29 matching lines...) Expand all
77 // re-deliver this invalidation in the event of a crash or restart. 78 // re-deliver this invalidation in the event of a crash or restart.
78 void Acknowledge() const; 79 void Acknowledge() const;
79 80
80 // Informs the ack tracker that this invalidation will not be serviced. 81 // Informs the ack tracker that this invalidation will not be serviced.
81 // 82 //
82 // If a client's buffer reaches its limit and it is forced to start dropping 83 // If a client's buffer reaches its limit and it is forced to start dropping
83 // invalidations, it should call this function before dropping its 84 // invalidations, it should call this function before dropping its
84 // invalidations in order to allow the ack tracker to drop the invalidation, 85 // invalidations in order to allow the ack tracker to drop the invalidation,
85 // too. 86 // too.
86 // 87 //
87 // The drop record will be tracked by the specified 88 // To indicate recovery from a drop event, the client should call
88 // DroppedInvalidationTracker. The caller should hang on to this tracker. It 89 // Acknowledge() on the most recently dropped inavlidation.
89 // will need to use it when it recovers from this drop event, or if it needs 90 void Drop();
90 // to record another drop event for the same ObjectID. Refer to the
91 // documentation of DroppedInvalidationTracker for more details.
92 void Drop(DroppedInvalidationTracker* tracker) const;
93 91
94 scoped_ptr<base::DictionaryValue> ToValue() const; 92 scoped_ptr<base::DictionaryValue> ToValue() const;
95 std::string ToString() const; 93 std::string ToString() const;
96 94
97 private: 95 private:
98 Invalidation(const invalidation::ObjectId& id, 96 Invalidation(const invalidation::ObjectId& id,
99 bool is_unknown_version, 97 bool is_unknown_version,
100 int64 version, 98 int64 version,
101 const std::string& payload, 99 const std::string& payload,
102 AckHandle ack_handle); 100 AckHandle ack_handle);
(...skipping 13 matching lines...) Expand all
116 std::string payload_; 114 std::string payload_;
117 115
118 // A locally generated unique ID used to manage local acknowledgements. 116 // A locally generated unique ID used to manage local acknowledgements.
119 AckHandle ack_handle_; 117 AckHandle ack_handle_;
120 syncer::WeakHandle<AckHandler> ack_handler_; 118 syncer::WeakHandle<AckHandler> ack_handler_;
121 }; 119 };
122 120
123 } // namespace syncer 121 } // namespace syncer
124 122
125 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_H_ 123 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_H_
OLDNEW
« no previous file with comments | « sync/engine/sync_scheduler_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