| 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 SYNC_ENGINE_WORKER_ENTITY_TRACKER_H_ | 5 #ifndef SYNC_ENGINE_WORKER_ENTITY_TRACKER_H_ |
| 6 #define SYNC_ENGINE_WORKER_ENTITY_TRACKER_H_ | 6 #define SYNC_ENGINE_WORKER_ENTITY_TRACKER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 WorkerEntityTracker(const std::string& id, | 38 WorkerEntityTracker(const std::string& id, |
| 39 const std::string& client_tag_hash); | 39 const std::string& client_tag_hash); |
| 40 | 40 |
| 41 ~WorkerEntityTracker(); | 41 ~WorkerEntityTracker(); |
| 42 | 42 |
| 43 // Returns true if this entity should be commited to the server. | 43 // Returns true if this entity should be commited to the server. |
| 44 bool HasPendingCommit() const; | 44 bool HasPendingCommit() const; |
| 45 | 45 |
| 46 // Populates a sync_pb::SyncEntity for a commit. Also sets the | 46 // Populates a sync_pb::SyncEntity for a commit. Also sets the |
| 47 // |sequence_number|, so we can track it throughout the commit process. | 47 // |sequence_number|, so we can track it throughout the commit process. |
| 48 void PrepareCommitProto(sync_pb::SyncEntity* commit_entity, | 48 void PopulateCommitProto(sync_pb::SyncEntity* commit_entity, |
| 49 int64_t* sequence_number) const; | 49 int64_t* sequence_number) const; |
| 50 | 50 |
| 51 // Updates this entity with data from the latest version that the | 51 // Updates this entity with data from the latest version that the |
| 52 // model asked us to commit. May clobber state related to the | 52 // model asked us to commit. May clobber state related to the |
| 53 // model's previous commit attempt(s). | 53 // model's previous commit attempt(s). |
| 54 void RequestCommit(const CommitRequestData& data); | 54 void RequestCommit(const CommitRequestData& data); |
| 55 | 55 |
| 56 // Handles the receipt of a commit response. | 56 // Handles the receipt of a commit response. |
| 57 // | 57 // |
| 58 // Since commits happen entirely on the sync thread, we can safely assume | 58 // Since commits happen entirely on the sync thread, we can safely assume |
| 59 // that our item's state at the end of the commit is the same as it was at | 59 // that our item's state at the end of the commit is the same as it was at |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // of an pending update prevents commits. As of this writing, the only | 119 // of an pending update prevents commits. As of this writing, the only |
| 120 // source of pending updates is updates that can't currently be decrypted. | 120 // source of pending updates is updates that can't currently be decrypted. |
| 121 std::unique_ptr<UpdateResponseData> encrypted_update_; | 121 std::unique_ptr<UpdateResponseData> encrypted_update_; |
| 122 | 122 |
| 123 DISALLOW_COPY_AND_ASSIGN(WorkerEntityTracker); | 123 DISALLOW_COPY_AND_ASSIGN(WorkerEntityTracker); |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 } // namespace syncer_v2 | 126 } // namespace syncer_v2 |
| 127 | 127 |
| 128 #endif // SYNC_ENGINE_WORKER_ENTITY_TRACKER_H_ | 128 #endif // SYNC_ENGINE_WORKER_ENTITY_TRACKER_H_ |
| OLD | NEW |