| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 | 428 |
| 429 // The server has the final say on positioning, so apply the absolute | 429 // The server has the final say on positioning, so apply the absolute |
| 430 // position that it returns. | 430 // position that it returns. |
| 431 if (entry_response.has_position_in_parent()) { | 431 if (entry_response.has_position_in_parent()) { |
| 432 // The SERVER_ field should already have been written. | 432 // The SERVER_ field should already have been written. |
| 433 DCHECK_EQ(entry_response.position_in_parent(), | 433 DCHECK_EQ(entry_response.position_in_parent(), |
| 434 local_entry->Get(SERVER_POSITION_IN_PARENT)); | 434 local_entry->Get(SERVER_POSITION_IN_PARENT)); |
| 435 | 435 |
| 436 // We just committed successfully, so we assume that the position | 436 // We just committed successfully, so we assume that the position |
| 437 // value we got applies to the PARENT_ID we submitted. | 437 // value we got applies to the PARENT_ID we submitted. |
| 438 syncable::Id new_prev = SyncerUtil::ComputePrevIdFromServerPosition( | 438 syncable::Id new_prev = local_entry->ComputePrevIdFromServerPosition( |
| 439 local_entry->write_transaction(), local_entry, | |
| 440 local_entry->Get(PARENT_ID)); | 439 local_entry->Get(PARENT_ID)); |
| 441 if (!local_entry->PutPredecessor(new_prev)) | 440 if (!local_entry->PutPredecessor(new_prev)) |
| 442 LOG(WARNING) << "PutPredecessor failed after successful commit"; | 441 LOG(WARNING) << "PutPredecessor failed after successful commit"; |
| 443 } | 442 } |
| 444 } | 443 } |
| 445 | 444 |
| 446 void ProcessCommitResponseCommand::ProcessSuccessfulCommitResponse( | 445 void ProcessCommitResponseCommand::ProcessSuccessfulCommitResponse( |
| 447 const sync_pb::SyncEntity& committed_entry, | 446 const sync_pb::SyncEntity& committed_entry, |
| 448 const CommitResponse_EntryResponse& entry_response, | 447 const CommitResponse_EntryResponse& entry_response, |
| 449 const syncable::Id& pre_commit_id, syncable::MutableEntry* local_entry, | 448 const syncable::Id& pre_commit_id, syncable::MutableEntry* local_entry, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 // been recursively deleted. | 481 // been recursively deleted. |
| 483 // TODO(nick): Here, commit_message.deleted() would be more correct than | 482 // 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 | 483 // 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. | 484 // deleted during the commit of the rename. Unit test & fix. |
| 486 if (local_entry->Get(IS_DIR) && local_entry->Get(IS_DEL)) { | 485 if (local_entry->Get(IS_DIR) && local_entry->Get(IS_DEL)) { |
| 487 deleted_folders->insert(local_entry->Get(ID)); | 486 deleted_folders->insert(local_entry->Get(ID)); |
| 488 } | 487 } |
| 489 } | 488 } |
| 490 | 489 |
| 491 } // namespace browser_sync | 490 } // namespace browser_sync |
| OLD | NEW |