Index: components/sync/engine_impl/conflict_resolver.cc |
diff --git a/sync/engine/conflict_resolver.cc b/components/sync/engine_impl/conflict_resolver.cc |
similarity index 84% |
rename from sync/engine/conflict_resolver.cc |
rename to components/sync/engine_impl/conflict_resolver.cc |
index d32460c5f29a67810871ed2b8cf1cac76f6e21e7..bb2bea3f9ce720fc5264b5cf6e513814f61d4e19 100644 |
--- a/sync/engine/conflict_resolver.cc |
+++ b/components/sync/engine_impl/conflict_resolver.cc |
@@ -2,21 +2,21 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "sync/engine/conflict_resolver.h" |
+#include "components/sync/engine_impl/conflict_resolver.h" |
#include <list> |
#include <set> |
#include <string> |
#include "base/metrics/histogram.h" |
-#include "sync/engine/conflict_util.h" |
-#include "sync/engine/syncer_util.h" |
-#include "sync/internal_api/public/sessions/update_counters.h" |
-#include "sync/sessions/status_controller.h" |
-#include "sync/syncable/directory.h" |
-#include "sync/syncable/mutable_entry.h" |
-#include "sync/syncable/syncable_write_transaction.h" |
-#include "sync/util/cryptographer.h" |
+#include "components/sync/base/cryptographer.h" |
+#include "components/sync/engine_impl/conflict_util.h" |
+#include "components/sync/engine_impl/syncer_util.h" |
+#include "components/sync/sessions/update_counters.h" |
+#include "components/sync/sessions_impl/status_controller.h" |
+#include "components/sync/syncable/directory.h" |
+#include "components/sync/syncable/mutable_entry.h" |
+#include "components/sync/syncable/syncable_write_transaction.h" |
using std::list; |
using std::set; |
@@ -63,11 +63,9 @@ bool AttachmentMetadataMatches(const MutableEntry& entity) { |
} // namespace |
-ConflictResolver::ConflictResolver() { |
-} |
+ConflictResolver::ConflictResolver() {} |
-ConflictResolver::~ConflictResolver() { |
-} |
+ConflictResolver::~ConflictResolver() {} |
void ConflictResolver::ProcessSimpleConflict(WriteTransaction* trans, |
const Id& id, |
@@ -125,8 +123,8 @@ void ConflictResolver::ProcessSimpleConflict(WriteTransaction* trans, |
// of three options: CLIENT, SERVER, or MERGE. Some datatypes (autofill) |
// are easily mergeable. |
// See http://crbug.com/77339. |
- bool name_matches = entry.GetNonUniqueName() == |
- entry.GetServerNonUniqueName(); |
+ bool name_matches = |
+ entry.GetNonUniqueName() == entry.GetServerNonUniqueName(); |
// The parent is implicit type root folder or the parent ID matches. |
bool parent_matches = entry.GetServerParentId().IsNull() || |
entry.GetParentId() == entry.GetServerParentId(); |
@@ -140,8 +138,9 @@ void ConflictResolver::ProcessSimpleConflict(WriteTransaction* trans, |
// Lucky for us, it's OK to be wrong here. The position_matches check is |
// allowed to return false negatives, as long as it returns no false |
// positives. |
- bool position_matches = parent_matches && |
- entry.GetServerUniquePosition().Equals(entry.GetUniquePosition()); |
+ bool position_matches = |
+ parent_matches && |
+ entry.GetServerUniquePosition().Equals(entry.GetUniquePosition()); |
const sync_pb::EntitySpecifics& specifics = entry.GetSpecifics(); |
const sync_pb::EntitySpecifics& server_specifics = |
entry.GetServerSpecifics(); |
@@ -152,8 +151,8 @@ void ConflictResolver::ProcessSimpleConflict(WriteTransaction* trans, |
bool server_encrypted_with_default_key = false; |
if (specifics.has_encrypted()) { |
DCHECK(cryptographer->CanDecryptUsingDefaultKey(specifics.encrypted())); |
- decrypted_specifics = cryptographer->DecryptToString( |
- specifics.encrypted()); |
+ decrypted_specifics = |
+ cryptographer->DecryptToString(specifics.encrypted()); |
} else { |
decrypted_specifics = specifics.SerializeAsString(); |
} |
@@ -161,8 +160,8 @@ void ConflictResolver::ProcessSimpleConflict(WriteTransaction* trans, |
server_encrypted_with_default_key = |
cryptographer->CanDecryptUsingDefaultKey( |
server_specifics.encrypted()); |
- decrypted_server_specifics = cryptographer->DecryptToString( |
- server_specifics.encrypted()); |
+ decrypted_server_specifics = |
+ cryptographer->DecryptToString(server_specifics.encrypted()); |
} else { |
decrypted_server_specifics = server_specifics.SerializeAsString(); |
} |
@@ -178,11 +177,11 @@ void ConflictResolver::ProcessSimpleConflict(WriteTransaction* trans, |
decrypted_base_server_specifics = |
base_server_specifics.SerializeAsString(); |
} else { |
- decrypted_base_server_specifics = cryptographer->DecryptToString( |
- base_server_specifics.encrypted()); |
+ decrypted_base_server_specifics = |
+ cryptographer->DecryptToString(base_server_specifics.encrypted()); |
} |
if (decrypted_server_specifics == decrypted_base_server_specifics) |
- base_server_specifics_match = true; |
+ base_server_specifics_match = true; |
} |
bool attachment_metadata_matches = AttachmentMetadataMatches(entry); |
@@ -191,8 +190,7 @@ void ConflictResolver::ProcessSimpleConflict(WriteTransaction* trans, |
DVLOG(1) << "Resolving simple conflict, everything matches, ignoring " |
<< "changes for: " << entry; |
conflict_util::IgnoreConflict(&entry); |
- UMA_HISTOGRAM_ENUMERATION("Sync.ResolveSimpleConflict", |
- CHANGES_MATCH, |
+ UMA_HISTOGRAM_ENUMERATION("Sync.ResolveSimpleConflict", CHANGES_MATCH, |
CONFLICT_RESOLUTION_SIZE); |
} else if (base_server_specifics_match) { |
DVLOG(1) << "Resolving simple conflict, ignoring server encryption " |
@@ -200,8 +198,7 @@ void ConflictResolver::ProcessSimpleConflict(WriteTransaction* trans, |
status->increment_num_server_overwrites(); |
counters->num_server_overwrites++; |
conflict_util::OverwriteServerChanges(&entry); |
- UMA_HISTOGRAM_ENUMERATION("Sync.ResolveSimpleConflict", |
- IGNORE_ENCRYPTION, |
+ UMA_HISTOGRAM_ENUMERATION("Sync.ResolveSimpleConflict", IGNORE_ENCRYPTION, |
CONFLICT_RESOLUTION_SIZE); |
} else if (entry_deleted || !name_matches || !parent_matches) { |
// NOTE: The update application logic assumes that conflict resolution |
@@ -213,8 +210,7 @@ void ConflictResolver::ProcessSimpleConflict(WriteTransaction* trans, |
counters->num_server_overwrites++; |
DVLOG(1) << "Resolving simple conflict, overwriting server changes " |
<< "for: " << entry; |
- UMA_HISTOGRAM_ENUMERATION("Sync.ResolveSimpleConflict", |
- OVERWRITE_SERVER, |
+ UMA_HISTOGRAM_ENUMERATION("Sync.ResolveSimpleConflict", OVERWRITE_SERVER, |
CONFLICT_RESOLUTION_SIZE); |
} else { |
DVLOG(1) << "Resolving simple conflict, ignoring local changes for: " |
@@ -222,8 +218,7 @@ void ConflictResolver::ProcessSimpleConflict(WriteTransaction* trans, |
conflict_util::IgnoreLocalChanges(&entry); |
status->increment_num_local_overwrites(); |
counters->num_local_overwrites++; |
- UMA_HISTOGRAM_ENUMERATION("Sync.ResolveSimpleConflict", |
- OVERWRITE_LOCAL, |
+ UMA_HISTOGRAM_ENUMERATION("Sync.ResolveSimpleConflict", OVERWRITE_LOCAL, |
CONFLICT_RESOLUTION_SIZE); |
} |
// Now that we've resolved the conflict, clear the prev server |
@@ -239,14 +234,12 @@ void ConflictResolver::ProcessSimpleConflict(WriteTransaction* trans, |
conflict_util::IgnoreLocalChanges(&entry); |
status->increment_num_local_overwrites(); |
counters->num_local_overwrites++; |
- UMA_HISTOGRAM_ENUMERATION("Sync.ResolveSimpleConflict", |
- OVERWRITE_LOCAL, |
+ UMA_HISTOGRAM_ENUMERATION("Sync.ResolveSimpleConflict", OVERWRITE_LOCAL, |
CONFLICT_RESOLUTION_SIZE); |
} else { |
if (entry.GetIsDir()) { |
Directory::Metahandles children; |
- trans->directory()->GetChildHandlesById(trans, |
- entry.GetId(), |
+ trans->directory()->GetChildHandlesById(trans, entry.GetId(), |
&children); |
// If a server deleted folder has local contents it should be a |
// hierarchy conflict. Hierarchy conflicts should not be processed by |
@@ -262,8 +255,7 @@ void ConflictResolver::ProcessSimpleConflict(WriteTransaction* trans, |
counters->num_server_overwrites++; |
DVLOG(1) << "Resolving simple conflict, undeleting server entry: " |
<< entry; |
- UMA_HISTOGRAM_ENUMERATION("Sync.ResolveSimpleConflict", |
- UNDELETE, |
+ UMA_HISTOGRAM_ENUMERATION("Sync.ResolveSimpleConflict", UNDELETE, |
CONFLICT_RESOLUTION_SIZE); |
} |
} |
@@ -277,14 +269,13 @@ void ConflictResolver::ResolveConflicts( |
UpdateCounters* counters) { |
// Iterate over simple conflict items. |
set<Id>::const_iterator it; |
- for (it = simple_conflict_ids.begin(); |
- it != simple_conflict_ids.end(); |
+ for (it = simple_conflict_ids.begin(); it != simple_conflict_ids.end(); |
++it) { |
// We don't resolve conflicts for control types here. |
Entry conflicting_node(trans, syncable::GET_BY_ID, *it); |
CHECK(conflicting_node.good()); |
if (IsControlType( |
- GetModelTypeFromSpecifics(conflicting_node.GetSpecifics()))) { |
+ GetModelTypeFromSpecifics(conflicting_node.GetSpecifics()))) { |
continue; |
} |