| 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/syncer_util.h" | 5 #include "sync/engine/syncer_util.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "sync/syncable/entry.h" | 24 #include "sync/syncable/entry.h" |
| 25 #include "sync/syncable/mutable_entry.h" | 25 #include "sync/syncable/mutable_entry.h" |
| 26 #include "sync/syncable/nigori_util.h" | 26 #include "sync/syncable/nigori_util.h" |
| 27 #include "sync/syncable/read_transaction.h" | 27 #include "sync/syncable/read_transaction.h" |
| 28 #include "sync/syncable/syncable_changes_version.h" | 28 #include "sync/syncable/syncable_changes_version.h" |
| 29 #include "sync/syncable/syncable_util.h" | 29 #include "sync/syncable/syncable_util.h" |
| 30 #include "sync/syncable/write_transaction.h" | 30 #include "sync/syncable/write_transaction.h" |
| 31 #include "sync/util/cryptographer.h" | 31 #include "sync/util/cryptographer.h" |
| 32 #include "sync/util/time.h" | 32 #include "sync/util/time.h" |
| 33 | 33 |
| 34 namespace syncer { |
| 35 |
| 34 using syncable::BASE_VERSION; | 36 using syncable::BASE_VERSION; |
| 35 using syncable::CHANGES_VERSION; | 37 using syncable::CHANGES_VERSION; |
| 36 using syncable::CREATE_NEW_UPDATE_ITEM; | 38 using syncable::CREATE_NEW_UPDATE_ITEM; |
| 37 using syncable::CTIME; | 39 using syncable::CTIME; |
| 38 using syncable::Directory; | 40 using syncable::Directory; |
| 39 using syncable::Entry; | 41 using syncable::Entry; |
| 40 using syncable::GET_BY_HANDLE; | 42 using syncable::GET_BY_HANDLE; |
| 41 using syncable::GET_BY_ID; | 43 using syncable::GET_BY_ID; |
| 42 using syncable::ID; | 44 using syncable::ID; |
| 43 using syncable::IS_DEL; | 45 using syncable::IS_DEL; |
| 44 using syncable::IS_DIR; | 46 using syncable::IS_DIR; |
| 45 using syncable::IS_UNAPPLIED_UPDATE; | 47 using syncable::IS_UNAPPLIED_UPDATE; |
| 46 using syncable::IS_UNSYNCED; | 48 using syncable::IS_UNSYNCED; |
| 47 using syncable::Id; | 49 using syncable::Id; |
| 48 using syncable::META_HANDLE; | 50 using syncable::META_HANDLE; |
| 49 using syncable::MTIME; | 51 using syncable::MTIME; |
| 50 using syncable::MutableEntry; | 52 using syncable::MutableEntry; |
| 51 using syncable::NON_UNIQUE_NAME; | 53 using syncable::NON_UNIQUE_NAME; |
| 52 using syncable::BASE_SERVER_SPECIFICS; | 54 using syncable::BASE_SERVER_SPECIFICS; |
| 53 using syncable::PARENT_ID; | 55 using syncable::PARENT_ID; |
| 54 using syncable::PREV_ID; | 56 using syncable::PREV_ID; |
| 55 using syncable::ReadTransaction; | |
| 56 using syncable::SERVER_CTIME; | 57 using syncable::SERVER_CTIME; |
| 57 using syncable::SERVER_IS_DEL; | 58 using syncable::SERVER_IS_DEL; |
| 58 using syncable::SERVER_IS_DIR; | 59 using syncable::SERVER_IS_DIR; |
| 59 using syncable::SERVER_MTIME; | 60 using syncable::SERVER_MTIME; |
| 60 using syncable::SERVER_NON_UNIQUE_NAME; | 61 using syncable::SERVER_NON_UNIQUE_NAME; |
| 61 using syncable::SERVER_PARENT_ID; | 62 using syncable::SERVER_PARENT_ID; |
| 62 using syncable::SERVER_POSITION_IN_PARENT; | 63 using syncable::SERVER_POSITION_IN_PARENT; |
| 63 using syncable::SERVER_SPECIFICS; | 64 using syncable::SERVER_SPECIFICS; |
| 64 using syncable::SERVER_VERSION; | 65 using syncable::SERVER_VERSION; |
| 65 using syncable::UNIQUE_CLIENT_TAG; | 66 using syncable::UNIQUE_CLIENT_TAG; |
| 66 using syncable::UNIQUE_SERVER_TAG; | 67 using syncable::UNIQUE_SERVER_TAG; |
| 67 using syncable::SPECIFICS; | 68 using syncable::SPECIFICS; |
| 68 using syncable::SYNCER; | 69 using syncable::SYNCER; |
| 69 using syncable::WriteTransaction; | 70 using syncable::WriteTransaction; |
| 70 | 71 |
| 71 namespace syncer { | |
| 72 | |
| 73 syncable::Id FindLocalIdToUpdate( | 72 syncable::Id FindLocalIdToUpdate( |
| 74 syncable::BaseTransaction* trans, | 73 syncable::BaseTransaction* trans, |
| 75 const SyncEntity& update) { | 74 const SyncEntity& update) { |
| 76 // Expected entry points of this function: | 75 // Expected entry points of this function: |
| 77 // SyncEntity has NOT been applied to SERVER fields. | 76 // SyncEntity has NOT been applied to SERVER fields. |
| 78 // SyncEntity has NOT been applied to LOCAL fields. | 77 // SyncEntity has NOT been applied to LOCAL fields. |
| 79 // DB has not yet been modified, no entries created for this update. | 78 // DB has not yet been modified, no entries created for this update. |
| 80 | 79 |
| 81 const std::string& client_id = trans->directory()->cache_guid(); | 80 const std::string& client_id = trans->directory()->cache_guid(); |
| 82 | 81 |
| (...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 if (update.version() < target->Get(SERVER_VERSION)) { | 690 if (update.version() < target->Get(SERVER_VERSION)) { |
| 692 LOG(WARNING) << "Update older than current server version for " | 691 LOG(WARNING) << "Update older than current server version for " |
| 693 << *target << " Update:" | 692 << *target << " Update:" |
| 694 << SyncerProtoUtil::SyncEntityDebugString(update); | 693 << SyncerProtoUtil::SyncEntityDebugString(update); |
| 695 return VERIFY_SUCCESS; // Expected in new sync protocol. | 694 return VERIFY_SUCCESS; // Expected in new sync protocol. |
| 696 } | 695 } |
| 697 return VERIFY_UNDECIDED; | 696 return VERIFY_UNDECIDED; |
| 698 } | 697 } |
| 699 | 698 |
| 700 } // namespace syncer | 699 } // namespace syncer |
| OLD | NEW |