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

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: More comments. Add racy test case Created 8 years, 11 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 local_entry->Put(syncable::NON_UNIQUE_NAME, server_name); 458 local_entry->Put(syncable::NON_UNIQUE_NAME, server_name);
459 } 459 }
460 460
461 // The server has the final say on positioning, so apply the absolute 461 // The server has the final say on positioning, so apply the absolute
462 // position that it returns. 462 // position that it returns.
463 if (entry_response.has_position_in_parent()) { 463 if (entry_response.has_position_in_parent()) {
464 // The SERVER_ field should already have been written. 464 // The SERVER_ field should already have been written.
465 DCHECK_EQ(entry_response.position_in_parent(), 465 DCHECK_EQ(entry_response.position_in_parent(),
466 local_entry->Get(SERVER_POSITION_IN_PARENT)); 466 local_entry->Get(SERVER_POSITION_IN_PARENT));
467 467
468 DVLOG(1) << "Response overrides local position of "
469 << local_entry->Get(syncable::ID)
470 << " from "
471 << local_entry->Get(syncable::SERVER_POSITION_IN_PARENT)
472 << " to " << entry_response.position_in_parent();
473
468 // We just committed successfully, so we assume that the position 474 // We just committed successfully, so we assume that the position
469 // value we got applies to the PARENT_ID we submitted. 475 // value we got applies to the PARENT_ID we submitted.
470 syncable::Id new_prev = local_entry->ComputePrevIdFromServerPosition( 476 syncable::Id new_prev = local_entry->ComputePrevIdFromServerPosition(
471 local_entry->Get(PARENT_ID)); 477 local_entry->Get(PARENT_ID));
472 if (!local_entry->PutPredecessor(new_prev)) { 478 if (!local_entry->PutPredecessor(new_prev)) {
473 // TODO(lipalani) : Propagate the error to caller. crbug.com/100444. 479 // TODO(lipalani) : Propagate the error to caller. crbug.com/100444.
474 NOTREACHED(); 480 NOTREACHED();
475 } 481 }
476 } 482 }
477 } 483 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 // been recursively deleted. 521 // been recursively deleted.
516 // TODO(nick): Here, commit_message.deleted() would be more correct than 522 // TODO(nick): Here, commit_message.deleted() would be more correct than
517 // local_entry->Get(IS_DEL). For example, an item could be renamed, and then 523 // local_entry->Get(IS_DEL). For example, an item could be renamed, and then
518 // deleted during the commit of the rename. Unit test & fix. 524 // deleted during the commit of the rename. Unit test & fix.
519 if (local_entry->Get(IS_DIR) && local_entry->Get(IS_DEL)) { 525 if (local_entry->Get(IS_DIR) && local_entry->Get(IS_DEL)) {
520 deleted_folders->insert(local_entry->Get(ID)); 526 deleted_folders->insert(local_entry->Get(ID));
521 } 527 }
522 } 528 }
523 529
524 } // namespace browser_sync 530 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698