| 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 15 matching lines...) Expand all Loading... |
| 26 using syncable::Entry; | 26 using syncable::Entry; |
| 27 using syncable::IS_DEL; | 27 using syncable::IS_DEL; |
| 28 using syncable::SERVER_POSITION_IN_PARENT; | 28 using syncable::SERVER_POSITION_IN_PARENT; |
| 29 using syncable::IS_UNAPPLIED_UPDATE; | 29 using syncable::IS_UNAPPLIED_UPDATE; |
| 30 using syncable::IS_UNSYNCED; | 30 using syncable::IS_UNSYNCED; |
| 31 using syncable::Id; | 31 using syncable::Id; |
| 32 using syncable::MutableEntry; | 32 using syncable::MutableEntry; |
| 33 using syncable::SPECIFICS; | 33 using syncable::SPECIFICS; |
| 34 using syncable::UNSPECIFIED; | 34 using syncable::UNSPECIFIED; |
| 35 | 35 |
| 36 namespace csync { | 36 namespace syncer { |
| 37 | 37 |
| 38 using sessions::SyncSession; | 38 using sessions::SyncSession; |
| 39 | 39 |
| 40 // static | 40 // static |
| 41 int64 BuildCommitCommand::GetFirstPosition() { | 41 int64 BuildCommitCommand::GetFirstPosition() { |
| 42 return std::numeric_limits<int64>::min(); | 42 return std::numeric_limits<int64>::min(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 // static | 45 // static |
| 46 int64 BuildCommitCommand::GetLastPosition() { | 46 int64 BuildCommitCommand::GetLastPosition() { |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 uint64 delta = static_cast<uint64>(hi) - static_cast<uint64>(lo); | 254 uint64 delta = static_cast<uint64>(hi) - static_cast<uint64>(lo); |
| 255 if (delta <= static_cast<uint64>(GetGap()*2)) | 255 if (delta <= static_cast<uint64>(GetGap()*2)) |
| 256 return lo + (static_cast<int64>(delta) + 7) / 8; // Interpolate. | 256 return lo + (static_cast<int64>(delta) + 7) / 8; // Interpolate. |
| 257 else if (lo == GetFirstPosition()) | 257 else if (lo == GetFirstPosition()) |
| 258 return hi - GetGap(); // Extend range just before successor. | 258 return hi - GetGap(); // Extend range just before successor. |
| 259 else | 259 else |
| 260 return lo + GetGap(); // Use or extend range just after predecessor. | 260 return lo + GetGap(); // Use or extend range just after predecessor. |
| 261 } | 261 } |
| 262 | 262 |
| 263 | 263 |
| 264 } // namespace csync | 264 } // namespace syncer |
| OLD | NEW |