| 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 "components/sync/engine_impl/syncer_util.h" | 5 #include "components/sync/engine_impl/syncer_util.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 entry->PutMtime(entry->GetServerMtime()); | 465 entry->PutMtime(entry->GetServerMtime()); |
| 466 entry->PutBaseVersion(entry->GetServerVersion()); | 466 entry->PutBaseVersion(entry->GetServerVersion()); |
| 467 entry->PutIsDel(entry->GetServerIsDel()); | 467 entry->PutIsDel(entry->GetServerIsDel()); |
| 468 entry->PutIsUnappliedUpdate(false); | 468 entry->PutIsUnappliedUpdate(false); |
| 469 entry->PutAttachmentMetadata(entry->GetServerAttachmentMetadata()); | 469 entry->PutAttachmentMetadata(entry->GetServerAttachmentMetadata()); |
| 470 } | 470 } |
| 471 | 471 |
| 472 VerifyCommitResult ValidateCommitEntry(syncable::Entry* entry) { | 472 VerifyCommitResult ValidateCommitEntry(syncable::Entry* entry) { |
| 473 syncable::Id id = entry->GetId(); | 473 syncable::Id id = entry->GetId(); |
| 474 if (id == entry->GetParentId()) { | 474 if (id == entry->GetParentId()) { |
| 475 CHECK(id.IsRoot()) << "Non-root item is self parenting." << *entry; | 475 // Non-root item is self parenting. |
| 476 CHECK(id.IsRoot()); |
| 476 // If the root becomes unsynced it can cause us problems. | 477 // If the root becomes unsynced it can cause us problems. |
| 477 LOG(ERROR) << "Root item became unsynced " << *entry; | 478 LOG(ERROR) << "Root item became unsynced " << *entry; |
| 478 return VERIFY_UNSYNCABLE; | 479 return VERIFY_UNSYNCABLE; |
| 479 } | 480 } |
| 480 if (entry->IsRoot()) { | 481 if (entry->IsRoot()) { |
| 481 LOG(ERROR) << "Permanent item became unsynced " << *entry; | 482 LOG(ERROR) << "Permanent item became unsynced " << *entry; |
| 482 return VERIFY_UNSYNCABLE; | 483 return VERIFY_UNSYNCABLE; |
| 483 } | 484 } |
| 484 if (entry->GetIsDel() && !entry->GetId().ServerKnows()) { | 485 if (entry->GetIsDel() && !entry->GetId().ServerKnows()) { |
| 485 // Drop deleted uncommitted entries. | 486 // Drop deleted uncommitted entries. |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 if (update.version() < target->GetServerVersion()) { | 643 if (update.version() < target->GetServerVersion()) { |
| 643 LOG(WARNING) << "Update older than current server version for " << *target | 644 LOG(WARNING) << "Update older than current server version for " << *target |
| 644 << " Update:" | 645 << " Update:" |
| 645 << SyncerProtoUtil::SyncEntityDebugString(update); | 646 << SyncerProtoUtil::SyncEntityDebugString(update); |
| 646 return VERIFY_SUCCESS; // Expected in new sync protocol. | 647 return VERIFY_SUCCESS; // Expected in new sync protocol. |
| 647 } | 648 } |
| 648 return VERIFY_UNDECIDED; | 649 return VERIFY_UNDECIDED; |
| 649 } | 650 } |
| 650 | 651 |
| 651 } // namespace syncer | 652 } // namespace syncer |
| OLD | NEW |