| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_SYNC_MODEL_IMPL_PROCESSOR_ENTITY_TRACKER_H_ | 5 #ifndef COMPONENTS_SYNC_MODEL_IMPL_PROCESSOR_ENTITY_TRACKER_H_ |
| 6 #define COMPONENTS_SYNC_MODEL_IMPL_PROCESSOR_ENTITY_TRACKER_H_ | 6 #define COMPONENTS_SYNC_MODEL_IMPL_PROCESSOR_ENTITY_TRACKER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // | 93 // |
| 94 // Note that the receipt of a successful commit response does not necessarily | 94 // Note that the receipt of a successful commit response does not necessarily |
| 95 // unset IsUnsynced(). If many local changes occur in quick succession, it's | 95 // unset IsUnsynced(). If many local changes occur in quick succession, it's |
| 96 // possible that the committed item was already out of date by the time it | 96 // possible that the committed item was already out of date by the time it |
| 97 // reached the server. | 97 // reached the server. |
| 98 void ReceiveCommitResponse(const CommitResponseData& data); | 98 void ReceiveCommitResponse(const CommitResponseData& data); |
| 99 | 99 |
| 100 // Clears any in-memory sync state associated with outstanding commits. | 100 // Clears any in-memory sync state associated with outstanding commits. |
| 101 void ClearTransientSyncState(); | 101 void ClearTransientSyncState(); |
| 102 | 102 |
| 103 // Update storage_key_. |
| 104 // This function should only be called by |
| 105 // ModelTypeChangeProcessor::UpdateStorageKey for the data type which does not |
| 106 // create storage key based on syncer::EntityData. |
| 107 void SetStorageKey(const std::string& new_key); |
| 108 |
| 103 // Takes the passed commit data updates its fields with values from metadata | 109 // Takes the passed commit data updates its fields with values from metadata |
| 104 // and caches it in the instance. The data is swapped from the input struct | 110 // and caches it in the instance. The data is swapped from the input struct |
| 105 // without copying. | 111 // without copying. |
| 106 void SetCommitData(EntityData* data); | 112 void SetCommitData(EntityData* data); |
| 107 | 113 |
| 108 // Caches the a copy of |data_ptr|, which doesn't copy the data itself. | 114 // Caches the a copy of |data_ptr|, which doesn't copy the data itself. |
| 109 void CacheCommitData(const EntityDataPtr& data_ptr); | 115 void CacheCommitData(const EntityDataPtr& data_ptr); |
| 110 | 116 |
| 111 // Check if the instance has cached commit data. | 117 // Check if the instance has cached commit data. |
| 112 bool HasCommitData() const; | 118 bool HasCommitData() const; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 132 ProcessorEntityTracker(const std::string& storage_key, | 138 ProcessorEntityTracker(const std::string& storage_key, |
| 133 sync_pb::EntityMetadata* metadata); | 139 sync_pb::EntityMetadata* metadata); |
| 134 | 140 |
| 135 // Check whether |specifics| matches the stored specifics_hash. | 141 // Check whether |specifics| matches the stored specifics_hash. |
| 136 bool MatchesSpecificsHash(const sync_pb::EntitySpecifics& specifics) const; | 142 bool MatchesSpecificsHash(const sync_pb::EntitySpecifics& specifics) const; |
| 137 | 143 |
| 138 // Update hash string for EntitySpecifics in the metadata. | 144 // Update hash string for EntitySpecifics in the metadata. |
| 139 void UpdateSpecificsHash(const sync_pb::EntitySpecifics& specifics); | 145 void UpdateSpecificsHash(const sync_pb::EntitySpecifics& specifics); |
| 140 | 146 |
| 141 // Storage key. Should always be available. | 147 // Storage key. Should always be available. |
| 142 const std::string storage_key_; | 148 std::string storage_key_; |
| 143 | 149 |
| 144 // Serializable Sync metadata. | 150 // Serializable Sync metadata. |
| 145 sync_pb::EntityMetadata metadata_; | 151 sync_pb::EntityMetadata metadata_; |
| 146 | 152 |
| 147 // Sync data that exists for items being committed only. | 153 // Sync data that exists for items being committed only. |
| 148 // The data is reset once commit confirmation is received. | 154 // The data is reset once commit confirmation is received. |
| 149 EntityDataPtr commit_data_; | 155 EntityDataPtr commit_data_; |
| 150 | 156 |
| 151 // The sequence number of the last item sent to the sync thread. | 157 // The sequence number of the last item sent to the sync thread. |
| 152 int64_t commit_requested_sequence_number_; | 158 int64_t commit_requested_sequence_number_; |
| 153 }; | 159 }; |
| 154 | 160 |
| 155 } // namespace syncer | 161 } // namespace syncer |
| 156 | 162 |
| 157 #endif // COMPONENTS_SYNC_MODEL_IMPL_PROCESSOR_ENTITY_TRACKER_H_ | 163 #endif // COMPONENTS_SYNC_MODEL_IMPL_PROCESSOR_ENTITY_TRACKER_H_ |
| OLD | NEW |