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 "chrome/browser/sync/glue/bookmark_model_associator.h" | 5 #include "chrome/browser/sync/glue/bookmark_model_associator.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 // There is another matching node which means the local node | 856 // There is another matching node which means the local node |
857 // has been either moved or edited. | 857 // has been either moved or edited. |
858 // In this case assume the local model to be correct, delete the | 858 // In this case assume the local model to be correct, delete the |
859 // sync node, and let the matching node to be propagated to Sync. | 859 // sync node, and let the matching node to be propagated to Sync. |
860 // TODO(stanisc): crbug/456876: this should really be handled with | 860 // TODO(stanisc): crbug/456876: this should really be handled with |
861 // a move, but the move depends on the traversal order. | 861 // a move, but the move depends on the traversal order. |
862 int num = RemoveSyncNodeHierarchy(trans, sync_child_node.GetId()); | 862 int num = RemoveSyncNodeHierarchy(trans, sync_child_node.GetId()); |
863 context->IncrementSyncItemsDeleted(num); | 863 context->IncrementSyncItemsDeleted(num); |
864 continue; | 864 continue; |
865 } | 865 } |
| 866 } else { |
| 867 // Existing sync node isn't associated. This is unexpected during |
| 868 // optimistic association unless there the previous association failed |
| 869 // to |
| 870 // persist extern IDs (that might be the case because persisting |
| 871 // external |
| 872 // IDs is delayed). |
| 873 // Report this error only once per session. |
| 874 static bool g_unmatched_unassociated_node_reported = false; |
| 875 if (!g_unmatched_unassociated_node_reported) { |
| 876 g_unmatched_unassociated_node_reported = true; |
| 877 unrecoverable_error_handler_->CreateAndUploadError( |
| 878 FROM_HERE, |
| 879 "Unassociated sync node detected during optimistic association", |
| 880 model_type()); |
| 881 } |
866 } | 882 } |
867 | 883 |
868 syncer::SyncError error; | 884 syncer::SyncError error; |
869 child_node = CreateBookmarkNode(parent_node, index, &sync_child_node, url, | 885 child_node = CreateBookmarkNode(parent_node, index, &sync_child_node, url, |
870 context, &error); | 886 context, &error); |
871 if (!child_node) { | 887 if (!child_node) { |
872 if (error.IsSet()) { | 888 if (error.IsSet()) { |
873 return error; | 889 return error; |
874 } else { | 890 } else { |
875 // Skip this node and continue. Don't increment index in this case. | 891 // Skip this node and continue. Don't increment index in this case. |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 syncer::BOOKMARKS); | 1189 syncer::BOOKMARKS); |
1174 } else { | 1190 } else { |
1175 context->set_native_model_sync_state(BEHIND); | 1191 context->set_native_model_sync_state(BEHIND); |
1176 } | 1192 } |
1177 } | 1193 } |
1178 } | 1194 } |
1179 return syncer::SyncError(); | 1195 return syncer::SyncError(); |
1180 } | 1196 } |
1181 | 1197 |
1182 } // namespace browser_sync | 1198 } // namespace browser_sync |
OLD | NEW |