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

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

Issue 442623002: Revert of sync: Add non-blocking type encryption support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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
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_ENTITY_TRACKER_H_ 5 #ifndef SYNC_ENGINE_ENTITY_TRACKER_H_
6 #define SYNC_ENGINE_ENTITY_TRACKER_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/memory/scoped_ptr.h"
12 #include "base/time/time.h" 11 #include "base/time/time.h"
13 #include "sync/base/sync_export.h" 12 #include "sync/base/sync_export.h"
14 #include "sync/internal_api/public/non_blocking_sync_common.h"
15 #include "sync/protocol/sync.pb.h" 13 #include "sync/protocol/sync.pb.h"
16 14
17 namespace syncer { 15 namespace syncer {
18 16
19 // 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
20 // thread. 18 // thread.
21 // 19 //
22 // It should be considered a helper class internal to the 20 // It should be considered a helper class internal to the
23 // ModelTypeSyncWorker. 21 // ModelTypeSyncWorker.
24 // 22 //
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // Since commits happen entirely on the sync thread, we can safely assume 74 // Since commits happen entirely on the sync thread, we can safely assume
77 // that our item's state at the end of the commit is the same as it was at 75 // that our item's state at the end of the commit is the same as it was at
78 // the start. 76 // the start.
79 void ReceiveCommitResponse(const std::string& response_id, 77 void ReceiveCommitResponse(const std::string& response_id,
80 int64 response_version, 78 int64 response_version,
81 int64 sequence_number); 79 int64 sequence_number);
82 80
83 // Handles receipt of an update from the server. 81 // Handles receipt of an update from the server.
84 void ReceiveUpdate(int64 version); 82 void ReceiveUpdate(int64 version);
85 83
86 // Handles the receipt of an pending update from the server.
87 //
88 // Returns true if the tracker decides this item is worth keeping. Returns
89 // false if the item is discarded, which could happen if the version number
90 // is out of date.
91 bool ReceivePendingUpdate(const UpdateResponseData& data);
92
93 // Functions to fetch the latest pending update.
94 bool HasPendingUpdate() const;
95 UpdateResponseData GetPendingUpdate() const;
96
97 // Clears the pending update. Allows us to resume regular commit behavior.
98 void ClearPendingUpdate();
99
100 private: 84 private:
101 // Initializes received update state. Does not initialize state related to 85 // Initializes received update state. Does not initialize state related to
102 // pending commits and sets |is_commit_pending_| to false. 86 // pending commits and sets |is_commit_pending_| to false.
103 EntityTracker(const std::string& id, 87 EntityTracker(const std::string& id,
104 const std::string& client_tag_hash, 88 const std::string& client_tag_hash,
105 int64 highest_commit_response_version, 89 int64 highest_commit_response_version,
106 int64 highest_gu_response_version); 90 int64 highest_gu_response_version);
107 91
108 // Initializes all fields. Sets |is_commit_pending_| to true. 92 // Initializes all fields. Sets |is_commit_pending_| to true.
109 EntityTracker(const std::string& id, 93 EntityTracker(const std::string& id,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // The following fields are valid only when a commit is pending. 139 // The following fields are valid only when a commit is pending.
156 // 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
157 // at the next possible opportunity. 141 // at the next possible opportunity.
158 int64 base_version_; 142 int64 base_version_;
159 base::Time ctime_; 143 base::Time ctime_;
160 base::Time mtime_; 144 base::Time mtime_;
161 std::string non_unique_name_; 145 std::string non_unique_name_;
162 bool deleted_; 146 bool deleted_;
163 sync_pb::EntitySpecifics specifics_; 147 sync_pb::EntitySpecifics specifics_;
164 148
165 // An update for this item which can't be applied right now. The presence of
166 // an pending update prevents commits. As of this writing, the only source
167 // of pending updates is updates we can't decrypt right now.
168 scoped_ptr<UpdateResponseData> pending_update_;
169
170 DISALLOW_COPY_AND_ASSIGN(EntityTracker); 149 DISALLOW_COPY_AND_ASSIGN(EntityTracker);
171 }; 150 };
172 151
173 } // namespace syncer 152 } // namespace syncer
174 153
175 #endif // SYNC_ENGINE_ENTITY_TRACKER_H_ 154 #endif // SYNC_ENGINE_ENTITY_TRACKER_H_
OLDNEW
« no previous file with comments | « components/sync_driver/non_blocking_data_type_controller_unittest.cc ('k') | sync/engine/entity_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698