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

Side by Side Diff: sync/engine/entity_tracker.h

Issue 351523003: sync: Mass rename of non-blocking sync classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: const ref some smart pointers Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « components/sync_driver/non_blocking_data_type_manager.cc ('k') | sync/engine/entity_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 SYNC_ENGINE_SYNC_THREAD_SYNC_ENTITY_H_ 5 #ifndef SYNC_ENGINE_ENTITY_TRACKER_H_
6 #define SYNC_ENGINE_SYNC_THREAD_SYNC_ENTITY_H_ 6 #define SYNC_ENGINE_ENTITY_TRACKER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "sync/base/sync_export.h" 12 #include "sync/base/sync_export.h"
13 #include "sync/protocol/sync.pb.h" 13 #include "sync/protocol/sync.pb.h"
14 14
15 namespace syncer { 15 namespace syncer {
16 16
17 // Manages the pending commit and update state for an entity on the sync 17 // Manages the pending commit and update state for an entity on the sync
18 // thread. 18 // thread.
19 // 19 //
20 // It should be considered a helper class internal to the 20 // It should be considered a helper class internal to the
21 // NonBlockingTypeProcessorCore. 21 // ModelTypeSyncWorker.
22 // 22 //
23 // Maintains the state associated with a particular sync entity which is 23 // Maintains the state associated with a particular sync entity which is
24 // necessary for decision-making on the sync thread. It can track pending 24 // necessary for decision-making on the sync thread. It can track pending
25 // commit state, received update state, and can detect conflicts. 25 // commit state, received update state, and can detect conflicts.
26 // 26 //
27 // This object may or may not contain state associated with a pending commit. 27 // This object may or may not contain state associated with a pending commit.
28 // If no commit is pending, the |is_commit_pending_| flag will be set to false 28 // If no commit is pending, the |is_commit_pending_| flag will be set to false
29 // and many of this object's fields will be cleared. 29 // and many of this object's fields will be cleared.
30 class SYNC_EXPORT SyncThreadSyncEntity { 30 class SYNC_EXPORT EntityTracker {
31 public: 31 public:
32 ~SyncThreadSyncEntity(); 32 ~EntityTracker();
33 33
34 // Initialize a new entity based on an update response. 34 // Initialize a new entity based on an update response.
35 static SyncThreadSyncEntity* FromServerUpdate( 35 static EntityTracker* FromServerUpdate(const std::string& id_string,
36 const std::string& id_string, 36 const std::string& client_tag_hash,
37 const std::string& client_tag_hash, 37 int64 version);
38 int64 version);
39 38
40 // Initialize a new entity based on a commit request. 39 // Initialize a new entity based on a commit request.
41 static SyncThreadSyncEntity* FromCommitRequest( 40 static EntityTracker* FromCommitRequest(
42 const std::string& id_string, 41 const std::string& id_string,
43 const std::string& client_tag_hash, 42 const std::string& client_tag_hash,
44 int64 sequence_number, 43 int64 sequence_number,
45 int64 base_version, 44 int64 base_version,
46 base::Time ctime, 45 base::Time ctime,
47 base::Time mtime, 46 base::Time mtime,
48 const std::string& non_unique_name, 47 const std::string& non_unique_name,
49 bool deleted, 48 bool deleted,
50 const sync_pb::EntitySpecifics& specifics); 49 const sync_pb::EntitySpecifics& specifics);
51 50
(...skipping 26 matching lines...) Expand all
78 void ReceiveCommitResponse(const std::string& response_id, 77 void ReceiveCommitResponse(const std::string& response_id,
79 int64 response_version, 78 int64 response_version,
80 int64 sequence_number); 79 int64 sequence_number);
81 80
82 // Handles receipt of an update from the server. 81 // Handles receipt of an update from the server.
83 void ReceiveUpdate(int64 version); 82 void ReceiveUpdate(int64 version);
84 83
85 private: 84 private:
86 // Initializes received update state. Does not initialize state related to 85 // Initializes received update state. Does not initialize state related to
87 // pending commits and sets |is_commit_pending_| to false. 86 // pending commits and sets |is_commit_pending_| to false.
88 SyncThreadSyncEntity(const std::string& id, 87 EntityTracker(const std::string& id,
89 const std::string& client_tag_hash, 88 const std::string& client_tag_hash,
90 int64 highest_commit_response_version, 89 int64 highest_commit_response_version,
91 int64 highest_gu_response_version); 90 int64 highest_gu_response_version);
92 91
93 // Initializes all fields. Sets |is_commit_pending_| to true. 92 // Initializes all fields. Sets |is_commit_pending_| to true.
94 SyncThreadSyncEntity(const std::string& id, 93 EntityTracker(const std::string& id,
95 const std::string& client_tag_hash, 94 const std::string& client_tag_hash,
96 int64 highest_commit_response_version, 95 int64 highest_commit_response_version,
97 int64 highest_gu_response_version, 96 int64 highest_gu_response_version,
98 bool is_commit_pending, 97 bool is_commit_pending,
99 int64 sequence_number, 98 int64 sequence_number,
100 int64 base_version, 99 int64 base_version,
101 base::Time ctime, 100 base::Time ctime,
102 base::Time mtime, 101 base::Time mtime,
103 const std::string& non_unique_name, 102 const std::string& non_unique_name,
104 bool deleted, 103 bool deleted,
105 const sync_pb::EntitySpecifics& specifics); 104 const sync_pb::EntitySpecifics& specifics);
106 105
107 // Checks if the current state indicates a conflict. 106 // Checks if the current state indicates a conflict.
108 // 107 //
109 // This can be true only while a call to this object is in progress. 108 // This can be true only while a call to this object is in progress.
110 // Conflicts are always cleared before the method call ends. 109 // Conflicts are always cleared before the method call ends.
111 bool IsInConflict() const; 110 bool IsInConflict() const;
112 111
113 // Checks if the server knows about this item. 112 // Checks if the server knows about this item.
114 bool IsServerKnown() const; 113 bool IsServerKnown() const;
115 114
(...skipping 24 matching lines...) Expand all
140 // The following fields are valid only when a commit is pending. 139 // The following fields are valid only when a commit is pending.
141 // This is where we store the data that is to be sent up to the server 140 // This is where we store the data that is to be sent up to the server
142 // at the next possible opportunity. 141 // at the next possible opportunity.
143 int64 base_version_; 142 int64 base_version_;
144 base::Time ctime_; 143 base::Time ctime_;
145 base::Time mtime_; 144 base::Time mtime_;
146 std::string non_unique_name_; 145 std::string non_unique_name_;
147 bool deleted_; 146 bool deleted_;
148 sync_pb::EntitySpecifics specifics_; 147 sync_pb::EntitySpecifics specifics_;
149 148
150 DISALLOW_COPY_AND_ASSIGN(SyncThreadSyncEntity); 149 DISALLOW_COPY_AND_ASSIGN(EntityTracker);
151 }; 150 };
152 151
153 } // namespace syncer 152 } // namespace syncer
154 153
155 #endif // SYNC_ENGINE_SYNC_THREAD_SYNC_ENTITY_H_ 154 #endif // SYNC_ENGINE_ENTITY_TRACKER_H_
OLDNEW
« no previous file with comments | « components/sync_driver/non_blocking_data_type_manager.cc ('k') | sync/engine/entity_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698