OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 // removed entirely (if this type of undeletion is indeed impossible). | 626 // removed entirely (if this type of undeletion is indeed impossible). |
627 CHECK(target->good()); | 627 CHECK(target->good()); |
628 DVLOG(1) << "Server update is attempting undelete. " << *target | 628 DVLOG(1) << "Server update is attempting undelete. " << *target |
629 << "Update:" << SyncerProtoUtil::SyncEntityDebugString(update); | 629 << "Update:" << SyncerProtoUtil::SyncEntityDebugString(update); |
630 // Move the old one aside and start over. It's too tricky to get the old one | 630 // Move the old one aside and start over. It's too tricky to get the old one |
631 // back into a state that would pass CheckTreeInvariants(). | 631 // back into a state that would pass CheckTreeInvariants(). |
632 if (target->Get(IS_DEL)) { | 632 if (target->Get(IS_DEL)) { |
633 DCHECK(target->Get(UNIQUE_CLIENT_TAG).empty()) | 633 DCHECK(target->Get(UNIQUE_CLIENT_TAG).empty()) |
634 << "Doing move-aside undeletion on client-tagged item."; | 634 << "Doing move-aside undeletion on client-tagged item."; |
635 target->Put(ID, trans->directory()->NextId()); | 635 target->Put(ID, trans->directory()->NextId()); |
636 target->Put(UNIQUE_CLIENT_TAG, ""); | 636 target->Put(UNIQUE_CLIENT_TAG, std::string()); |
637 target->Put(BASE_VERSION, CHANGES_VERSION); | 637 target->Put(BASE_VERSION, CHANGES_VERSION); |
638 target->Put(SERVER_VERSION, 0); | 638 target->Put(SERVER_VERSION, 0); |
639 return VERIFY_SUCCESS; | 639 return VERIFY_SUCCESS; |
640 } | 640 } |
641 if (update.version() < target->Get(SERVER_VERSION)) { | 641 if (update.version() < target->Get(SERVER_VERSION)) { |
642 LOG(WARNING) << "Update older than current server version for " | 642 LOG(WARNING) << "Update older than current server version for " |
643 << *target << " Update:" | 643 << *target << " Update:" |
644 << SyncerProtoUtil::SyncEntityDebugString(update); | 644 << SyncerProtoUtil::SyncEntityDebugString(update); |
645 return VERIFY_SUCCESS; // Expected in new sync protocol. | 645 return VERIFY_SUCCESS; // Expected in new sync protocol. |
646 } | 646 } |
647 return VERIFY_UNDECIDED; | 647 return VERIFY_UNDECIDED; |
648 } | 648 } |
649 | 649 |
650 } // namespace syncer | 650 } // namespace syncer |
OLD | NEW |