| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sync/engine/build_commit_command.h" | 5 #include "chrome/browser/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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } else { | 197 } else { |
| 198 position_block = std::make_pair( | 198 position_block = std::make_pair( |
| 199 FindAnchorPosition(syncable::PREV_ID, meta_entry), | 199 FindAnchorPosition(syncable::PREV_ID, meta_entry), |
| 200 FindAnchorPosition(syncable::NEXT_ID, meta_entry)); | 200 FindAnchorPosition(syncable::NEXT_ID, meta_entry)); |
| 201 } | 201 } |
| 202 position_block.first = InterpolatePosition(position_block.first, | 202 position_block.first = InterpolatePosition(position_block.first, |
| 203 position_block.second); | 203 position_block.second); |
| 204 | 204 |
| 205 position_map[id] = position_block; | 205 position_map[id] = position_block; |
| 206 sync_entry->set_position_in_parent(position_block.first); | 206 sync_entry->set_position_in_parent(position_block.first); |
| 207 DVLOG(1) << "Setting server position for entry " |
| 208 << meta_entry.Get(syncable::ID).GetServerId() |
| 209 << " from " |
| 210 << meta_entry.Get(syncable::SERVER_POSITION_IN_PARENT) |
| 211 << " to " << position_block.first; |
| 207 } | 212 } |
| 208 SetEntrySpecifics(&meta_entry, sync_entry); | 213 SetEntrySpecifics(&meta_entry, sync_entry); |
| 209 } | 214 } |
| 210 } | 215 } |
| 211 session->mutable_status_controller()-> | 216 session->mutable_status_controller()-> |
| 212 mutable_commit_message()->CopyFrom(message); | 217 mutable_commit_message()->CopyFrom(message); |
| 213 } | 218 } |
| 214 | 219 |
| 215 int64 BuildCommitCommand::FindAnchorPosition(syncable::IdField direction, | 220 int64 BuildCommitCommand::FindAnchorPosition(syncable::IdField direction, |
| 216 const syncable::Entry& entry) { | 221 const syncable::Entry& entry) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 244 if (delta <= static_cast<uint64>(GetGap()*2)) | 249 if (delta <= static_cast<uint64>(GetGap()*2)) |
| 245 return lo + (static_cast<int64>(delta) + 7) / 8; // Interpolate. | 250 return lo + (static_cast<int64>(delta) + 7) / 8; // Interpolate. |
| 246 else if (lo == GetFirstPosition()) | 251 else if (lo == GetFirstPosition()) |
| 247 return hi - GetGap(); // Extend range just before successor. | 252 return hi - GetGap(); // Extend range just before successor. |
| 248 else | 253 else |
| 249 return lo + GetGap(); // Use or extend range just after predecessor. | 254 return lo + GetGap(); // Use or extend range just after predecessor. |
| 250 } | 255 } |
| 251 | 256 |
| 252 | 257 |
| 253 } // namespace browser_sync | 258 } // namespace browser_sync |
| OLD | NEW |