| 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 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // re-deliver this invalidation in the event of a crash or restart. | 77 // re-deliver this invalidation in the event of a crash or restart. |
| 78 void Acknowledge() const; | 78 void Acknowledge() const; |
| 79 | 79 |
| 80 // Informs the ack tracker that this invalidation will not be serviced. | 80 // Informs the ack tracker that this invalidation will not be serviced. |
| 81 // | 81 // |
| 82 // If a client's buffer reaches its limit and it is forced to start dropping | 82 // 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 | 83 // invalidations, it should call this function before dropping its |
| 84 // invalidations in order to allow the ack tracker to drop the invalidation, | 84 // invalidations in order to allow the ack tracker to drop the invalidation, |
| 85 // too. | 85 // too. |
| 86 // | 86 // |
| 87 // The drop record will be tracked by the specified | 87 // To indicate recovery from a drop event, the client should call |
| 88 // DroppedInvalidationTracker. The caller should hang on to this tracker. It | 88 // Acknowledge() on the most recently dropped inavlidation. |
| 89 // will need to use it when it recovers from this drop event, or if it needs | 89 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 | 90 |
| 94 scoped_ptr<base::DictionaryValue> ToValue() const; | 91 scoped_ptr<base::DictionaryValue> ToValue() const; |
| 95 std::string ToString() const; | 92 std::string ToString() const; |
| 96 | 93 |
| 97 private: | 94 private: |
| 98 Invalidation(const invalidation::ObjectId& id, | 95 Invalidation(const invalidation::ObjectId& id, |
| 99 bool is_unknown_version, | 96 bool is_unknown_version, |
| 100 int64 version, | 97 int64 version, |
| 101 const std::string& payload, | 98 const std::string& payload, |
| 102 AckHandle ack_handle); | 99 AckHandle ack_handle); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 116 std::string payload_; | 113 std::string payload_; |
| 117 | 114 |
| 118 // A locally generated unique ID used to manage local acknowledgements. | 115 // A locally generated unique ID used to manage local acknowledgements. |
| 119 AckHandle ack_handle_; | 116 AckHandle ack_handle_; |
| 120 syncer::WeakHandle<AckHandler> ack_handler_; | 117 syncer::WeakHandle<AckHandler> ack_handler_; |
| 121 }; | 118 }; |
| 122 | 119 |
| 123 } // namespace syncer | 120 } // namespace syncer |
| 124 | 121 |
| 125 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_H_ | 122 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_H_ |
| OLD | NEW |