| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 return local_entry.Get(ID); | 177 return local_entry.Get(ID); |
| 178 } | 178 } |
| 179 } | 179 } |
| 180 // Fallback: target an entry having the server ID, creating one if needed. | 180 // Fallback: target an entry having the server ID, creating one if needed. |
| 181 return update_id; | 181 return update_id; |
| 182 } | 182 } |
| 183 | 183 |
| 184 UpdateAttemptResponse AttemptToUpdateEntry( | 184 UpdateAttemptResponse AttemptToUpdateEntry( |
| 185 syncable::WriteTransaction* const trans, | 185 syncable::WriteTransaction* const trans, |
| 186 syncable::MutableEntry* const entry, | 186 syncable::MutableEntry* const entry, |
| 187 ConflictResolver* resolver, | |
| 188 Cryptographer* cryptographer) { | 187 Cryptographer* cryptographer) { |
| 189 CHECK(entry->good()); | 188 CHECK(entry->good()); |
| 190 if (!entry->Get(IS_UNAPPLIED_UPDATE)) | 189 if (!entry->Get(IS_UNAPPLIED_UPDATE)) |
| 191 return SUCCESS; // No work to do. | 190 return SUCCESS; // No work to do. |
| 192 syncable::Id id = entry->Get(ID); | 191 syncable::Id id = entry->Get(ID); |
| 193 const sync_pb::EntitySpecifics& specifics = entry->Get(SERVER_SPECIFICS); | 192 const sync_pb::EntitySpecifics& specifics = entry->Get(SERVER_SPECIFICS); |
| 194 | 193 |
| 195 // Only apply updates that we can decrypt. If we can't decrypt the update, it | 194 // Only apply updates that we can decrypt. If we can't decrypt the update, it |
| 196 // is likely because the passphrase has not arrived yet. Because the | 195 // is likely because the passphrase has not arrived yet. Because the |
| 197 // passphrase may not arrive within this GetUpdates, we can't just return | 196 // passphrase may not arrive within this GetUpdates, we can't just return |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 if (update.version() < target->Get(SERVER_VERSION)) { | 644 if (update.version() < target->Get(SERVER_VERSION)) { |
| 646 LOG(WARNING) << "Update older than current server version for " | 645 LOG(WARNING) << "Update older than current server version for " |
| 647 << *target << " Update:" | 646 << *target << " Update:" |
| 648 << SyncerProtoUtil::SyncEntityDebugString(update); | 647 << SyncerProtoUtil::SyncEntityDebugString(update); |
| 649 return VERIFY_SUCCESS; // Expected in new sync protocol. | 648 return VERIFY_SUCCESS; // Expected in new sync protocol. |
| 650 } | 649 } |
| 651 return VERIFY_UNDECIDED; | 650 return VERIFY_UNDECIDED; |
| 652 } | 651 } |
| 653 | 652 |
| 654 } // namespace syncer | 653 } // namespace syncer |
| OLD | NEW |