Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(827)

Unified Diff: chrome/browser/sync/engine/process_commit_response_command.cc

Issue 371029: Remove unique naming. (Closed)
Patch Set: Ready and about to go in! Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/engine/process_commit_response_command.cc
diff --git a/chrome/browser/sync/engine/process_commit_response_command.cc b/chrome/browser/sync/engine/process_commit_response_command.cc
old mode 100644
new mode 100755
index e65a7f1c2a80b519d2ea22233c6cdfa189226d6f..f0fe41367e803ae5b198090c5fd0f07ead875c9d
--- a/chrome/browser/sync/engine/process_commit_response_command.cc
+++ b/chrome/browser/sync/engine/process_commit_response_command.cc
@@ -20,9 +20,6 @@ using syncable::ScopedDirLookup;
using syncable::WriteTransaction;
using syncable::MutableEntry;
using syncable::Entry;
-using syncable::Name;
-using syncable::SyncName;
-using syncable::DBName;
using std::set;
using std::vector;
@@ -124,6 +121,7 @@ void ProcessCommitResponseCommand::ProcessCommitResponse(
break;
case CommitResponse::CONFLICT:
++conflicting_commits;
+ // This is important to activate conflict resolution.
session->AddCommitConflict(commit_ids[i]);
break;
case CommitResponse::SUCCESS:
@@ -339,33 +337,15 @@ void ProcessCommitResponseCommand::PerformCommitTimeNameAside(
syncable::WriteTransaction* trans,
const CommitResponse_EntryResponse& server_entry,
syncable::MutableEntry* local_entry) {
- Name old_name(local_entry->GetName());
-
- // Ensure that we don't collide with an existing entry.
- SyncName server_name =
+ PathString old_name = local_entry->Get(syncable::NON_UNIQUE_NAME);
+ const string server_name =
SyncerProtoUtil::NameFromCommitEntryResponse(server_entry);
- LOG(INFO) << "Server provided committed name:" << server_name.value();
- if (!server_name.value().empty() &&
- static_cast<SyncName&>(old_name) != server_name) {
- LOG(INFO) << "Server name differs from local name, attempting"
- << " commit time name aside.";
-
- DBName db_name(server_name.value());
- db_name.MakeOSLegal();
-
- // This is going to produce ~1 names instead of (Edited) names.
- // Since this should be EXTREMELY rare, we do this for now.
- db_name.MakeNoncollidingForEntry(trans, local_entry->Get(SERVER_PARENT_ID),
- local_entry);
-
- CHECK(!db_name.empty());
-
- LOG(INFO) << "Server commit moved aside entry: " << old_name.db_value()
- << " to new name " << db_name;
-
+ if (!server_name.empty() && old_name != server_name) {
+ LOG(INFO) << "Server commit moved aside entry: " << old_name
+ << " to new name " << server_name;
// Should be safe since we're in a "commit lock."
- local_entry->PutName(Name::FromDBNameAndSyncName(db_name, server_name));
+ local_entry->Put(syncable::NON_UNIQUE_NAME, server_name);
}
}
« no previous file with comments | « chrome/browser/sync/engine/get_commit_ids_command.h ('k') | chrome/browser/sync/engine/process_updates_command.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698