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

Side by Side Diff: sync/engine/build_commit_command.cc

Issue 11637053: sync: Start moving away from PREV_ID and NEXT_ID (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 11 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 | « no previous file | sync/engine/conflict_resolver.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 #include "sync/engine/build_commit_command.h" 5 #include "sync/engine/build_commit_command.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 } 190 }
191 sync_entry->set_ctime(TimeToProtoTime(meta_entry.Get(syncable::CTIME))); 191 sync_entry->set_ctime(TimeToProtoTime(meta_entry.Get(syncable::CTIME)));
192 sync_entry->set_mtime(TimeToProtoTime(meta_entry.Get(syncable::MTIME))); 192 sync_entry->set_mtime(TimeToProtoTime(meta_entry.Get(syncable::MTIME)));
193 193
194 // Deletion is final on the server, let's move things and then delete them. 194 // Deletion is final on the server, let's move things and then delete them.
195 if (meta_entry.Get(IS_DEL)) { 195 if (meta_entry.Get(IS_DEL)) {
196 sync_entry->set_deleted(true); 196 sync_entry->set_deleted(true);
197 } else { 197 } else {
198 if (meta_entry.Get(SPECIFICS).has_bookmark()) { 198 if (meta_entry.Get(SPECIFICS).has_bookmark()) {
199 // Common data in both new and old protocol. 199 // Common data in both new and old protocol.
200 const Id& prev_id = meta_entry.Get(syncable::PREV_ID); 200 const Id& prev_id = meta_entry.GetPredecessorId();
201 string prev_id_string = 201 string prev_id_string =
202 prev_id.IsRoot() ? string() : prev_id.GetServerId(); 202 prev_id.IsRoot() ? string() : prev_id.GetServerId();
203 sync_entry->set_insert_after_item_id(prev_id_string); 203 sync_entry->set_insert_after_item_id(prev_id_string);
204 204
205 // Compute a numeric position based on what we know locally. 205 // Compute a numeric position based on what we know locally.
206 std::pair<int64, int64> position_block( 206 std::pair<int64, int64> position_block(
207 GetFirstPosition(), GetLastPosition()); 207 GetFirstPosition(), GetLastPosition());
208 std::map<Id, std::pair<int64, int64> >::iterator prev_pos = 208 std::map<Id, std::pair<int64, int64> >::iterator prev_pos =
209 position_map.find(prev_id); 209 position_map.find(prev_id);
210 if (prev_pos != position_map.end()) { 210 if (prev_pos != position_map.end()) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 if (delta <= static_cast<uint64>(GetGap()*2)) 260 if (delta <= static_cast<uint64>(GetGap()*2))
261 return lo + (static_cast<int64>(delta) + 7) / 8; // Interpolate. 261 return lo + (static_cast<int64>(delta) + 7) / 8; // Interpolate.
262 else if (lo == GetFirstPosition()) 262 else if (lo == GetFirstPosition())
263 return hi - GetGap(); // Extend range just before successor. 263 return hi - GetGap(); // Extend range just before successor.
264 else 264 else
265 return lo + GetGap(); // Use or extend range just after predecessor. 265 return lo + GetGap(); // Use or extend range just after predecessor.
266 } 266 }
267 267
268 268
269 } // namespace syncer 269 } // namespace syncer
OLDNEW
« no previous file with comments | « no previous file | sync/engine/conflict_resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698