OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 entry. | 3 // found in the LICENSE entry. |
4 | 4 |
5 #include "chrome/browser/sync/engine/conflict_resolver.h" | 5 #include "chrome/browser/sync/engine/conflict_resolver.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "chrome/browser/sync/engine/syncer.h" | 10 #include "chrome/browser/sync/engine/syncer.h" |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 break; | 524 break; |
525 } | 525 } |
526 if (!parent.Get(syncable::IS_DEL) || | 526 if (!parent.Get(syncable::IS_DEL) || |
527 parent.Get(syncable::SERVER_IS_DEL) || | 527 parent.Get(syncable::SERVER_IS_DEL) || |
528 !parent.Get(syncable::IS_UNSYNCED)) { | 528 !parent.Get(syncable::IS_UNSYNCED)) { |
529 return false; | 529 return false; |
530 } | 530 } |
531 id = parent.Get(syncable::PARENT_ID); | 531 id = parent.Get(syncable::PARENT_ID); |
532 } | 532 } |
533 // If we find we've been looping we re-root the hierarchy. | 533 // If we find we've been looping we re-root the hierarchy. |
534 if (loop_detection < 0) | 534 if (loop_detection < 0) { |
535 if (id == entry.Get(syncable::ID)) | 535 if (id == entry.Get(syncable::ID)) |
536 reroot_id = entry.Get(syncable::PARENT_ID); | 536 reroot_id = entry.Get(syncable::PARENT_ID); |
537 else | 537 else |
538 reroot_id = id; | 538 reroot_id = id; |
| 539 } |
539 // Now we fix things up by undeleting all the folders in the item's path. | 540 // Now we fix things up by undeleting all the folders in the item's path. |
540 id = parent_id; | 541 id = parent_id; |
541 while (!id.IsRoot() && id != reroot_id) { | 542 while (!id.IsRoot() && id != reroot_id) { |
542 if (!binary_search(conflict_set->begin(), conflict_set->end(), id)) | 543 if (!binary_search(conflict_set->begin(), conflict_set->end(), id)) |
543 break; | 544 break; |
544 MutableEntry entry(trans, syncable::GET_BY_ID, id); | 545 MutableEntry entry(trans, syncable::GET_BY_ID, id); |
545 Id parent_id = entry.Get(syncable::PARENT_ID); | 546 Id parent_id = entry.Get(syncable::PARENT_ID); |
546 if (parent_id == reroot_id) | 547 if (parent_id == reroot_id) |
547 parent_id = trans->root_id(); | 548 parent_id = trans->root_id(); |
548 Name old_name = entry.GetName(); | 549 Name old_name = entry.GetName(); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 conflict_set_count_map_.erase(i++); | 746 conflict_set_count_map_.erase(i++); |
746 // METRIC self resolved conflict sets ++. | 747 // METRIC self resolved conflict sets ++. |
747 } else { | 748 } else { |
748 ++i; | 749 ++i; |
749 } | 750 } |
750 } | 751 } |
751 return rv; | 752 return rv; |
752 } | 753 } |
753 | 754 |
754 } // namespace browser_sync | 755 } // namespace browser_sync |
OLD | NEW |