| 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/conflict_resolver.h" | 5 #include "components/sync/engine_impl/conflict_resolver.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "components/sync/base/cryptographer.h" | 12 #include "components/sync/base/cryptographer.h" |
| 13 #include "components/sync/engine/cycle/update_counters.h" |
| 13 #include "components/sync/engine_impl/conflict_util.h" | 14 #include "components/sync/engine_impl/conflict_util.h" |
| 15 #include "components/sync/engine_impl/cycle/status_controller.h" |
| 14 #include "components/sync/engine_impl/syncer_util.h" | 16 #include "components/sync/engine_impl/syncer_util.h" |
| 15 #include "components/sync/sessions/update_counters.h" | |
| 16 #include "components/sync/sessions_impl/status_controller.h" | |
| 17 #include "components/sync/syncable/directory.h" | 17 #include "components/sync/syncable/directory.h" |
| 18 #include "components/sync/syncable/mutable_entry.h" | 18 #include "components/sync/syncable/mutable_entry.h" |
| 19 #include "components/sync/syncable/syncable_write_transaction.h" | 19 #include "components/sync/syncable/syncable_write_transaction.h" |
| 20 | 20 |
| 21 using std::list; | 21 using std::list; |
| 22 using std::set; | 22 using std::set; |
| 23 | 23 |
| 24 namespace syncer { | 24 namespace syncer { |
| 25 | 25 |
| 26 using sessions::StatusController; | |
| 27 using syncable::Directory; | 26 using syncable::Directory; |
| 28 using syncable::Entry; | 27 using syncable::Entry; |
| 29 using syncable::Id; | 28 using syncable::Id; |
| 30 using syncable::MutableEntry; | 29 using syncable::MutableEntry; |
| 31 using syncable::WriteTransaction; | 30 using syncable::WriteTransaction; |
| 32 | 31 |
| 33 namespace { | 32 namespace { |
| 34 | 33 |
| 35 // Returns true iff the set of attachment ids contained in attachment_metadata | 34 // Returns true iff the set of attachment ids contained in attachment_metadata |
| 36 // matches the set of ids contained in server_attachment_metadata. | 35 // matches the set of ids contained in server_attachment_metadata. |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 UMA_HISTOGRAM_ENUMERATION("Sync.ResolveSimpleConflict", UNDELETE, | 257 UMA_HISTOGRAM_ENUMERATION("Sync.ResolveSimpleConflict", UNDELETE, |
| 259 CONFLICT_RESOLUTION_SIZE); | 258 CONFLICT_RESOLUTION_SIZE); |
| 260 } | 259 } |
| 261 } | 260 } |
| 262 } | 261 } |
| 263 | 262 |
| 264 void ConflictResolver::ResolveConflicts( | 263 void ConflictResolver::ResolveConflicts( |
| 265 syncable::WriteTransaction* trans, | 264 syncable::WriteTransaction* trans, |
| 266 const Cryptographer* cryptographer, | 265 const Cryptographer* cryptographer, |
| 267 const std::set<syncable::Id>& simple_conflict_ids, | 266 const std::set<syncable::Id>& simple_conflict_ids, |
| 268 sessions::StatusController* status, | 267 StatusController* status, |
| 269 UpdateCounters* counters) { | 268 UpdateCounters* counters) { |
| 270 // Iterate over simple conflict items. | 269 // Iterate over simple conflict items. |
| 271 set<Id>::const_iterator it; | 270 set<Id>::const_iterator it; |
| 272 for (it = simple_conflict_ids.begin(); it != simple_conflict_ids.end(); | 271 for (it = simple_conflict_ids.begin(); it != simple_conflict_ids.end(); |
| 273 ++it) { | 272 ++it) { |
| 274 // We don't resolve conflicts for control types here. | 273 // We don't resolve conflicts for control types here. |
| 275 Entry conflicting_node(trans, syncable::GET_BY_ID, *it); | 274 Entry conflicting_node(trans, syncable::GET_BY_ID, *it); |
| 276 CHECK(conflicting_node.good()); | 275 CHECK(conflicting_node.good()); |
| 277 if (IsControlType( | 276 if (IsControlType( |
| 278 GetModelTypeFromSpecifics(conflicting_node.GetSpecifics()))) { | 277 GetModelTypeFromSpecifics(conflicting_node.GetSpecifics()))) { |
| 279 continue; | 278 continue; |
| 280 } | 279 } |
| 281 | 280 |
| 282 ProcessSimpleConflict(trans, *it, cryptographer, status, counters); | 281 ProcessSimpleConflict(trans, *it, cryptographer, status, counters); |
| 283 } | 282 } |
| 284 return; | 283 return; |
| 285 } | 284 } |
| 286 | 285 |
| 287 } // namespace syncer | 286 } // namespace syncer |
| OLD | NEW |