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

Side by Side Diff: sync/engine/syncer_util.cc

Issue 1246063003: Sync: Don't set/use Parent ID for non-hierarchical sync data types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months 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 unified diff | Download patch
OLDNEW
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 "sync/engine/syncer_util.h" 5 #include "sync/engine/syncer_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 } else { 399 } else {
400 // Otherwise, fake a server version by bumping the local number. 400 // Otherwise, fake a server version by bumping the local number.
401 target->PutServerVersion( 401 target->PutServerVersion(
402 std::max(target->GetServerVersion(), target->GetBaseVersion()) + 1); 402 std::max(target->GetServerVersion(), target->GetBaseVersion()) + 1);
403 } 403 }
404 return; 404 return;
405 } 405 }
406 406
407 DCHECK_EQ(target->GetId(), SyncableIdFromProto(update.id_string())) 407 DCHECK_EQ(target->GetId(), SyncableIdFromProto(update.id_string()))
408 << "ID Changing not supported here"; 408 << "ID Changing not supported here";
409 target->PutServerParentId(SyncableIdFromProto(update.parent_id_string())); 409 if (SyncerProtoUtil::ShouldMaintainHierarchy(update)) {
410 target->PutServerParentId(SyncableIdFromProto(update.parent_id_string()));
411 } else {
412 target->PutServerParentId(syncable::Id());
413 }
410 target->PutServerNonUniqueName(name); 414 target->PutServerNonUniqueName(name);
411 target->PutServerVersion(update.version()); 415 target->PutServerVersion(update.version());
412 target->PutServerCtime(ProtoTimeToTime(update.ctime())); 416 target->PutServerCtime(ProtoTimeToTime(update.ctime()));
413 target->PutServerMtime(ProtoTimeToTime(update.mtime())); 417 target->PutServerMtime(ProtoTimeToTime(update.mtime()));
414 target->PutServerIsDir(IsFolder(update)); 418 target->PutServerIsDir(IsFolder(update));
415 if (update.has_server_defined_unique_tag()) { 419 if (update.has_server_defined_unique_tag()) {
416 const std::string& tag = update.server_defined_unique_tag(); 420 const std::string& tag = update.server_defined_unique_tag();
417 target->PutUniqueServerTag(tag); 421 target->PutUniqueServerTag(tag);
418 } 422 }
419 if (update.has_client_defined_unique_tag()) { 423 if (update.has_client_defined_unique_tag()) {
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 if (update.version() < target->GetServerVersion()) { 675 if (update.version() < target->GetServerVersion()) {
672 LOG(WARNING) << "Update older than current server version for " 676 LOG(WARNING) << "Update older than current server version for "
673 << *target << " Update:" 677 << *target << " Update:"
674 << SyncerProtoUtil::SyncEntityDebugString(update); 678 << SyncerProtoUtil::SyncEntityDebugString(update);
675 return VERIFY_SUCCESS; // Expected in new sync protocol. 679 return VERIFY_SUCCESS; // Expected in new sync protocol.
676 } 680 }
677 return VERIFY_UNDECIDED; 681 return VERIFY_UNDECIDED;
678 } 682 }
679 683
680 } // namespace syncer 684 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698