OLD | NEW |
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 <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 // position that it returns. | 432 // position that it returns. |
433 if (entry_response.has_position_in_parent()) { | 433 if (entry_response.has_position_in_parent()) { |
434 // The SERVER_ field should already have been written. | 434 // The SERVER_ field should already have been written. |
435 DCHECK_EQ(entry_response.position_in_parent(), | 435 DCHECK_EQ(entry_response.position_in_parent(), |
436 local_entry->Get(SERVER_POSITION_IN_PARENT)); | 436 local_entry->Get(SERVER_POSITION_IN_PARENT)); |
437 | 437 |
438 // We just committed successfully, so we assume that the position | 438 // We just committed successfully, so we assume that the position |
439 // value we got applies to the PARENT_ID we submitted. | 439 // value we got applies to the PARENT_ID we submitted. |
440 syncable::Id new_prev = local_entry->ComputePrevIdFromServerPosition( | 440 syncable::Id new_prev = local_entry->ComputePrevIdFromServerPosition( |
441 local_entry->Get(PARENT_ID)); | 441 local_entry->Get(PARENT_ID)); |
442 CHECK(local_entry->PutPredecessor(new_prev)); | 442 if (!local_entry->PutPredecessor(new_prev)) { |
| 443 // TODO(lipalani) : Propagate the error to caller. crbug.com/100444. |
| 444 NOTREACHED(); |
| 445 } |
443 } | 446 } |
444 } | 447 } |
445 | 448 |
446 void ProcessCommitResponseCommand::ProcessSuccessfulCommitResponse( | 449 void ProcessCommitResponseCommand::ProcessSuccessfulCommitResponse( |
447 const sync_pb::SyncEntity& committed_entry, | 450 const sync_pb::SyncEntity& committed_entry, |
448 const CommitResponse_EntryResponse& entry_response, | 451 const CommitResponse_EntryResponse& entry_response, |
449 const syncable::Id& pre_commit_id, syncable::MutableEntry* local_entry, | 452 const syncable::Id& pre_commit_id, syncable::MutableEntry* local_entry, |
450 bool syncing_was_set, set<syncable::Id>* deleted_folders) { | 453 bool syncing_was_set, set<syncable::Id>* deleted_folders) { |
451 DCHECK(local_entry->Get(IS_UNSYNCED)); | 454 DCHECK(local_entry->Get(IS_UNSYNCED)); |
452 | 455 |
(...skipping 29 matching lines...) Expand all Loading... |
482 // been recursively deleted. | 485 // been recursively deleted. |
483 // TODO(nick): Here, commit_message.deleted() would be more correct than | 486 // TODO(nick): Here, commit_message.deleted() would be more correct than |
484 // local_entry->Get(IS_DEL). For example, an item could be renamed, and then | 487 // local_entry->Get(IS_DEL). For example, an item could be renamed, and then |
485 // deleted during the commit of the rename. Unit test & fix. | 488 // deleted during the commit of the rename. Unit test & fix. |
486 if (local_entry->Get(IS_DIR) && local_entry->Get(IS_DEL)) { | 489 if (local_entry->Get(IS_DIR) && local_entry->Get(IS_DEL)) { |
487 deleted_folders->insert(local_entry->Get(ID)); | 490 deleted_folders->insert(local_entry->Get(ID)); |
488 } | 491 } |
489 } | 492 } |
490 | 493 |
491 } // namespace browser_sync | 494 } // namespace browser_sync |
OLD | NEW |