| 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> |
| 11 | 11 |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "sync/engine/syncer_proto_util.h" | 13 #include "sync/engine/syncer_proto_util.h" |
| 14 #include "sync/protocol/bookmark_specifics.pb.h" | 14 #include "sync/protocol/bookmark_specifics.pb.h" |
| 15 #include "sync/sessions/ordered_commit_set.h" | 15 #include "sync/sessions/ordered_commit_set.h" |
| 16 #include "sync/sessions/sync_session.h" | 16 #include "sync/sessions/sync_session.h" |
| 17 #include "sync/syncable/directory.h" | 17 #include "sync/syncable/directory.h" |
| 18 #include "sync/syncable/mutable_entry.h" | 18 #include "sync/syncable/mutable_entry.h" |
| 19 #include "sync/syncable/syncable_changes_version.h" | 19 #include "sync/syncable/syncable_changes_version.h" |
| 20 #include "sync/syncable/write_transaction.h" | 20 #include "sync/syncable/write_transaction.h" |
| 21 #include "sync/util/time.h" | 21 #include "sync/util/time.h" |
| 22 | 22 |
| 23 using std::set; | 23 using std::set; |
| 24 using std::string; | 24 using std::string; |
| 25 using std::vector; | 25 using std::vector; |
| 26 |
| 27 namespace syncer { |
| 28 |
| 29 using sessions::SyncSession; |
| 26 using syncable::Entry; | 30 using syncable::Entry; |
| 27 using syncable::IS_DEL; | 31 using syncable::IS_DEL; |
| 28 using syncable::SERVER_POSITION_IN_PARENT; | 32 using syncable::SERVER_POSITION_IN_PARENT; |
| 29 using syncable::IS_UNAPPLIED_UPDATE; | 33 using syncable::IS_UNAPPLIED_UPDATE; |
| 30 using syncable::IS_UNSYNCED; | 34 using syncable::IS_UNSYNCED; |
| 31 using syncable::Id; | 35 using syncable::Id; |
| 32 using syncable::MutableEntry; | 36 using syncable::MutableEntry; |
| 33 using syncable::SPECIFICS; | 37 using syncable::SPECIFICS; |
| 34 using syncable::UNSPECIFIED; | 38 using syncable::UNSPECIFIED; |
| 35 | 39 |
| 36 namespace syncer { | |
| 37 | |
| 38 using sessions::SyncSession; | |
| 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() { |
| 47 return std::numeric_limits<int64>::max(); | 47 return std::numeric_limits<int64>::max(); |
| 48 } | 48 } |
| 49 | 49 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 syncer | 264 } // namespace syncer |
| OLD | NEW |