From 82b1cd9fc88d353b541064e52c4ed408033a43cf Mon Sep 17 00:00:00 2001 From: "chron@google.com" Date: Fri, 20 Nov 2009 01:41:34 +0000 Subject: Remove unique naming from syncer! This reduces the complexity. Modify the index to store things with parent id and metahandle instead of parent id and name. Add a template function for extracting name from proto buffers. Refactor some unit tests to work without unique naming. Remove path calls since they make no sense without unique names. Remove find by parentID and names. Remove unique name resolution from conflict resolver. Remove syncable name class. TEST=included unit tests Review URL: http://codereview.chromium.org/371029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32583 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/sync/engine/syncer_proto_util.cc | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) mode change 100644 => 100755 chrome/browser/sync/engine/syncer_proto_util.cc (limited to 'chrome/browser/sync/engine/syncer_proto_util.cc') diff --git a/chrome/browser/sync/engine/syncer_proto_util.cc b/chrome/browser/sync/engine/syncer_proto_util.cc old mode 100644 new mode 100755 index 5767d20..75b6689 --- a/chrome/browser/sync/engine/syncer_proto_util.cc +++ b/chrome/browser/sync/engine/syncer_proto_util.cc @@ -167,7 +167,7 @@ bool SyncerProtoUtil::PostClientToServerMessage(ClientToServerMessage* msg, // static bool SyncerProtoUtil::Compare(const syncable::Entry& local_entry, const SyncEntity& server_entry) { - SyncName name = NameFromSyncEntity(server_entry); + const std::string name = NameFromSyncEntity(server_entry); CHECK(local_entry.Get(ID) == server_entry.id()) << " SyncerProtoUtil::Compare precondition not met."; @@ -185,7 +185,7 @@ bool SyncerProtoUtil::Compare(const syncable::Entry& local_entry, // These checks are somewhat prolix, but they're easier to debug than a big // boolean statement. - SyncName client_name = local_entry.GetName(); + PathString client_name = local_entry.Get(syncable::NON_UNIQUE_NAME); if (client_name != name) { LOG(WARNING) << "Client name mismatch"; return false; @@ -235,23 +235,25 @@ void SyncerProtoUtil::CopyBlobIntoProtoBytes(const syncable::Blob& blob, } // static -syncable::SyncName SyncerProtoUtil::NameFromSyncEntity( +std::string SyncerProtoUtil::NameFromSyncEntity( const SyncEntity& entry) { - SyncName result(entry.name()); + if (entry.has_non_unique_name()) { - result.set_non_unique_value(entry.non_unique_name()); + return entry.non_unique_name(); } - return result; + + return entry.name(); } // static -syncable::SyncName SyncerProtoUtil::NameFromCommitEntryResponse( +std::string SyncerProtoUtil::NameFromCommitEntryResponse( const CommitResponse_EntryResponse& entry) { - SyncName result(entry.name()); + if (entry.has_non_unique_name()) { - result.set_non_unique_value(entry.non_unique_name()); + return entry.non_unique_name(); } - return result; + + return entry.name(); } } // namespace browser_sync -- cgit v1.1