| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 using sessions::SyncSession; | 31 using sessions::SyncSession; |
| 32 using syncable::Entry; | 32 using syncable::Entry; |
| 33 using syncable::IS_DEL; | 33 using syncable::IS_DEL; |
| 34 using syncable::SERVER_POSITION_IN_PARENT; | 34 using syncable::SERVER_POSITION_IN_PARENT; |
| 35 using syncable::IS_UNAPPLIED_UPDATE; | 35 using syncable::IS_UNAPPLIED_UPDATE; |
| 36 using syncable::IS_UNSYNCED; | 36 using syncable::IS_UNSYNCED; |
| 37 using syncable::Id; | 37 using syncable::Id; |
| 38 using syncable::MutableEntry; | 38 using syncable::MutableEntry; |
| 39 using syncable::SPECIFICS; | 39 using syncable::SPECIFICS; |
| 40 using syncer::UNSPECIFIED; | |
| 41 | 40 |
| 42 // static | 41 // static |
| 43 int64 BuildCommitCommand::GetFirstPosition() { | 42 int64 BuildCommitCommand::GetFirstPosition() { |
| 44 return std::numeric_limits<int64>::min(); | 43 return std::numeric_limits<int64>::min(); |
| 45 } | 44 } |
| 46 | 45 |
| 47 // static | 46 // static |
| 48 int64 BuildCommitCommand::GetLastPosition() { | 47 int64 BuildCommitCommand::GetLastPosition() { |
| 49 return std::numeric_limits<int64>::max(); | 48 return std::numeric_limits<int64>::max(); |
| 50 } | 49 } |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 if (delta <= static_cast<uint64>(GetGap()*2)) | 258 if (delta <= static_cast<uint64>(GetGap()*2)) |
| 260 return lo + (static_cast<int64>(delta) + 7) / 8; // Interpolate. | 259 return lo + (static_cast<int64>(delta) + 7) / 8; // Interpolate. |
| 261 else if (lo == GetFirstPosition()) | 260 else if (lo == GetFirstPosition()) |
| 262 return hi - GetGap(); // Extend range just before successor. | 261 return hi - GetGap(); // Extend range just before successor. |
| 263 else | 262 else |
| 264 return lo + GetGap(); // Use or extend range just after predecessor. | 263 return lo + GetGap(); // Use or extend range just after predecessor. |
| 265 } | 264 } |
| 266 | 265 |
| 267 | 266 |
| 268 } // namespace syncer | 267 } // namespace syncer |
| OLD | NEW |