OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/sync/engine/build_and_process_conflict_sets_command.h" | 5 #include "chrome/browser/sync/engine/build_and_process_conflict_sets_command.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <sstream> | 8 #include <sstream> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 return true; | 220 return true; |
221 } | 221 } |
222 | 222 |
223 void BuildAndProcessConflictSetsCommand::BuildConflictSets( | 223 void BuildAndProcessConflictSetsCommand::BuildConflictSets( |
224 syncable::BaseTransaction* trans, | 224 syncable::BaseTransaction* trans, |
225 ConflictProgress* conflict_progress) { | 225 ConflictProgress* conflict_progress) { |
226 conflict_progress->CleanupSets(); | 226 conflict_progress->CleanupSets(); |
227 set<syncable::Id>::iterator i = conflict_progress->ConflictingItemsBegin(); | 227 set<syncable::Id>::iterator i = conflict_progress->ConflictingItemsBegin(); |
228 while (i != conflict_progress->ConflictingItemsEnd()) { | 228 while (i != conflict_progress->ConflictingItemsEnd()) { |
229 syncable::Entry entry(trans, syncable::GET_BY_ID, *i); | 229 syncable::Entry entry(trans, syncable::GET_BY_ID, *i); |
230 CHECK(entry.good()); | 230 if (!entry.good() || |
231 if (!entry.Get(syncable::IS_UNSYNCED) && | 231 (!entry.Get(syncable::IS_UNSYNCED) && |
232 !entry.Get(syncable::IS_UNAPPLIED_UPDATE)) { | 232 !entry.Get(syncable::IS_UNAPPLIED_UPDATE))) { |
233 // This can happen very rarely. It means we had a simply conflicting item | 233 // This can happen very rarely. It means we had a simply conflicting item |
234 // that randomly committed. We drop the entry as it's no longer | 234 // that randomly committed; its ID could have changed during the commit. |
235 // conflicting. | 235 // We drop the entry as it's no longer conflicting. |
236 conflict_progress->EraseConflictingItemById(*(i++)); | 236 conflict_progress->EraseConflictingItemById(*(i++)); |
237 continue; | 237 continue; |
238 } | 238 } |
239 if (entry.ExistsOnClientBecauseNameIsNonEmpty() && | 239 if (entry.ExistsOnClientBecauseNameIsNonEmpty() && |
240 (entry.Get(syncable::IS_DEL) || entry.Get(syncable::SERVER_IS_DEL))) { | 240 (entry.Get(syncable::IS_DEL) || entry.Get(syncable::SERVER_IS_DEL))) { |
241 // If we're deleted on client or server we can't be in a complex set. | 241 // If we're deleted on client or server we can't be in a complex set. |
242 ++i; | 242 ++i; |
243 continue; | 243 continue; |
244 } | 244 } |
245 bool new_parent = | 245 bool new_parent = |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 LocallyDeletedPathChecker checker; | 399 LocallyDeletedPathChecker checker; |
400 if (!checker.CausingConflict(parent, *entry)) | 400 if (!checker.CausingConflict(parent, *entry)) |
401 return; | 401 return; |
402 conflict_progress->MergeSets(entry->Get(syncable::ID), | 402 conflict_progress->MergeSets(entry->Get(syncable::ID), |
403 parent.Get(syncable::ID)); | 403 parent.Get(syncable::ID)); |
404 CrawlDeletedTreeMergingSets(trans, parent, conflict_progress, checker); | 404 CrawlDeletedTreeMergingSets(trans, parent, conflict_progress, checker); |
405 } | 405 } |
406 } | 406 } |
407 | 407 |
408 } // namespace browser_sync | 408 } // namespace browser_sync |
OLD | NEW |