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

Side by Side Diff: chrome/browser/sync/engine/process_commit_response_command.cc

Issue 8922015: [Sync] Don't commit items with predecessors/parents in conflict. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ensure we clear BASE_SERVER_SPECIFICS Created 8 years, 12 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/sync/engine/process_commit_response_command.h" 5 #include "chrome/browser/sync/engine/process_commit_response_command.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 local_entry->Put(syncable::NON_UNIQUE_NAME, server_name); 450 local_entry->Put(syncable::NON_UNIQUE_NAME, server_name);
451 } 451 }
452 452
453 // The server has the final say on positioning, so apply the absolute 453 // The server has the final say on positioning, so apply the absolute
454 // position that it returns. 454 // position that it returns.
455 if (entry_response.has_position_in_parent()) { 455 if (entry_response.has_position_in_parent()) {
456 // The SERVER_ field should already have been written. 456 // The SERVER_ field should already have been written.
457 DCHECK_EQ(entry_response.position_in_parent(), 457 DCHECK_EQ(entry_response.position_in_parent(),
458 local_entry->Get(SERVER_POSITION_IN_PARENT)); 458 local_entry->Get(SERVER_POSITION_IN_PARENT));
459 459
460 DVLOG(1) << "Response overrides local position of "
461 << local_entry->Get(syncable::ID)
462 << " from "
463 << local_entry->Get(syncable::SERVER_POSITION_IN_PARENT)
464 << " to " << entry_response.position_in_parent();
465
460 // We just committed successfully, so we assume that the position 466 // We just committed successfully, so we assume that the position
461 // value we got applies to the PARENT_ID we submitted. 467 // value we got applies to the PARENT_ID we submitted.
462 syncable::Id new_prev = local_entry->ComputePrevIdFromServerPosition( 468 syncable::Id new_prev = local_entry->ComputePrevIdFromServerPosition(
463 local_entry->Get(PARENT_ID)); 469 local_entry->Get(PARENT_ID));
464 if (!local_entry->PutPredecessor(new_prev)) { 470 if (!local_entry->PutPredecessor(new_prev)) {
465 // TODO(lipalani) : Propagate the error to caller. crbug.com/100444. 471 // TODO(lipalani) : Propagate the error to caller. crbug.com/100444.
466 NOTREACHED(); 472 NOTREACHED();
467 } 473 }
468 } 474 }
469 } 475 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 // been recursively deleted. 513 // been recursively deleted.
508 // TODO(nick): Here, commit_message.deleted() would be more correct than 514 // TODO(nick): Here, commit_message.deleted() would be more correct than
509 // local_entry->Get(IS_DEL). For example, an item could be renamed, and then 515 // local_entry->Get(IS_DEL). For example, an item could be renamed, and then
510 // deleted during the commit of the rename. Unit test & fix. 516 // deleted during the commit of the rename. Unit test & fix.
511 if (local_entry->Get(IS_DIR) && local_entry->Get(IS_DEL)) { 517 if (local_entry->Get(IS_DIR) && local_entry->Get(IS_DEL)) {
512 deleted_folders->insert(local_entry->Get(ID)); 518 deleted_folders->insert(local_entry->Get(ID));
513 } 519 }
514 } 520 }
515 521
516 } // namespace browser_sync 522 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698