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_ENGINE_IMPL_WORKER_ENTITY_TRACKER_H_ | 5 #ifndef COMPONENTS_SYNC_ENGINE_IMPL_WORKER_ENTITY_TRACKER_H_ |
6 #define COMPONENTS_SYNC_ENGINE_IMPL_WORKER_ENTITY_TRACKER_H_ | 6 #define COMPONENTS_SYNC_ENGINE_IMPL_WORKER_ENTITY_TRACKER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "components/sync/base/sync_export.h" | |
16 #include "components/sync/protocol/sync.pb.h" | 15 #include "components/sync/protocol/sync.pb.h" |
17 | 16 |
18 namespace syncer_v2 { | 17 namespace syncer_v2 { |
19 struct CommitRequestData; | 18 struct CommitRequestData; |
20 struct CommitResponseData; | 19 struct CommitResponseData; |
21 struct UpdateResponseData; | 20 struct UpdateResponseData; |
22 | 21 |
23 // Manages the pending commit and update state for an entity on the sync | 22 // Manages the pending commit and update state for an entity on the sync |
24 // thread. | 23 // thread. |
25 // | 24 // |
26 // It should be considered a helper class internal to the | 25 // It should be considered a helper class internal to the |
27 // ModelTypeWorker. | 26 // ModelTypeWorker. |
28 // | 27 // |
29 // Maintains the state associated with a particular sync entity which is | 28 // Maintains the state associated with a particular sync entity which is |
30 // necessary for decision-making on the sync thread. It can track pending | 29 // necessary for decision-making on the sync thread. It can track pending |
31 // commit state, received update state, and can detect conflicts. | 30 // commit state, received update state, and can detect conflicts. |
32 // | 31 // |
33 // This object may contain state associated with a pending commit, pending | 32 // This object may contain state associated with a pending commit, pending |
34 // update, or both. | 33 // update, or both. |
35 class SYNC_EXPORT WorkerEntityTracker { | 34 class WorkerEntityTracker { |
36 public: | 35 public: |
37 // Initializes the entity tracker's main fields. Does not initialize state | 36 // Initializes the entity tracker's main fields. Does not initialize state |
38 // related to a pending commit. | 37 // related to a pending commit. |
39 WorkerEntityTracker(const std::string& id, | 38 WorkerEntityTracker(const std::string& id, |
40 const std::string& client_tag_hash); | 39 const std::string& client_tag_hash); |
41 | 40 |
42 ~WorkerEntityTracker(); | 41 ~WorkerEntityTracker(); |
43 | 42 |
44 // Returns true if this entity should be commited to the server. | 43 // Returns true if this entity should be commited to the server. |
45 bool HasPendingCommit() const; | 44 bool HasPendingCommit() const; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // of an pending update prevents commits. As of this writing, the only | 115 // of an pending update prevents commits. As of this writing, the only |
117 // source of pending updates is updates that can't currently be decrypted. | 116 // source of pending updates is updates that can't currently be decrypted. |
118 std::unique_ptr<UpdateResponseData> encrypted_update_; | 117 std::unique_ptr<UpdateResponseData> encrypted_update_; |
119 | 118 |
120 DISALLOW_COPY_AND_ASSIGN(WorkerEntityTracker); | 119 DISALLOW_COPY_AND_ASSIGN(WorkerEntityTracker); |
121 }; | 120 }; |
122 | 121 |
123 } // namespace syncer_v2 | 122 } // namespace syncer_v2 |
124 | 123 |
125 #endif // COMPONENTS_SYNC_ENGINE_IMPL_WORKER_ENTITY_TRACKER_H_ | 124 #endif // COMPONENTS_SYNC_ENGINE_IMPL_WORKER_ENTITY_TRACKER_H_ |
OLD | NEW |