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

Side by Side Diff: components/sync/engine_impl/worker_entity_tracker.h

Issue 2376123003: [Sync] Move //components/sync to the syncer namespace. (Closed)
Patch Set: Fix tools and iOS. Created 4 years, 2 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
OLDNEW
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/core/non_blocking_sync_common.h" 15 #include "components/sync/core/non_blocking_sync_common.h"
16 #include "components/sync/protocol/sync.pb.h" 16 #include "components/sync/protocol/sync.pb.h"
17 17
18 namespace syncer_v2 { 18 namespace syncer {
19 19
20 // Manages the pending commit and update state for an entity on the sync 20 // Manages the pending commit and update state for an entity on the sync
21 // thread. 21 // thread.
22 // 22 //
23 // It should be considered a helper class internal to the 23 // It should be considered a helper class internal to the
24 // ModelTypeWorker. 24 // ModelTypeWorker.
25 // 25 //
26 // Maintains the state associated with a particular sync entity which is 26 // Maintains the state associated with a particular sync entity which is
27 // necessary for decision-making on the sync thread. It can track pending 27 // necessary for decision-making on the sync thread. It can track pending
28 // commit state, received update state, and can detect conflicts. 28 // commit state, received update state, and can detect conflicts.
29 // 29 //
30 // This object may contain state associated with a pending commit, pending 30 // This object may contain state associated with a pending commit, pending
31 // update, or both. 31 // update, or both.
32 class WorkerEntityTracker { 32 class WorkerEntityTracker {
33 public: 33 public:
34 // Initializes the entity tracker's main fields. Does not initialize state 34 // Initializes the entity tracker's main fields. Does not initialize state
35 // related to a pending commit. 35 // related to a pending commit.
36 WorkerEntityTracker(const std::string& client_tag_hash); 36 explicit WorkerEntityTracker(const std::string& client_tag_hash);
37 37
38 ~WorkerEntityTracker(); 38 ~WorkerEntityTracker();
39 39
40 // Returns true if this entity should be commited to the server. 40 // Returns true if this entity should be commited to the server.
41 bool HasPendingCommit() const; 41 bool HasPendingCommit() const;
42 42
43 // Populates a sync_pb::SyncEntity for a commit. 43 // Populates a sync_pb::SyncEntity for a commit.
44 void PopulateCommitProto(sync_pb::SyncEntity* commit_entity) const; 44 void PopulateCommitProto(sync_pb::SyncEntity* commit_entity) const;
45 45
46 // Updates this entity with data from the latest version that the 46 // Updates this entity with data from the latest version that the
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 std::string pending_commit_specifics_hash_; 112 std::string pending_commit_specifics_hash_;
113 113
114 // An update for this entity which can't be applied right now. The presence 114 // An update for this entity which can't be applied right now. The presence
115 // 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
116 // 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.
117 std::unique_ptr<UpdateResponseData> encrypted_update_; 117 std::unique_ptr<UpdateResponseData> encrypted_update_;
118 118
119 DISALLOW_COPY_AND_ASSIGN(WorkerEntityTracker); 119 DISALLOW_COPY_AND_ASSIGN(WorkerEntityTracker);
120 }; 120 };
121 121
122 } // namespace syncer_v2 122 } // namespace syncer
123 123
124 #endif // COMPONENTS_SYNC_ENGINE_IMPL_WORKER_ENTITY_TRACKER_H_ 124 #endif // COMPONENTS_SYNC_ENGINE_IMPL_WORKER_ENTITY_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698