| 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 <cstddef> | 7 #include <cstddef> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 local_entry->Put(syncable::NON_UNIQUE_NAME, server_name); | 454 local_entry->Put(syncable::NON_UNIQUE_NAME, server_name); |
| 455 } | 455 } |
| 456 | 456 |
| 457 // The server has the final say on positioning, so apply the absolute | 457 // The server has the final say on positioning, so apply the absolute |
| 458 // position that it returns. | 458 // position that it returns. |
| 459 if (entry_response.has_position_in_parent()) { | 459 if (entry_response.has_position_in_parent()) { |
| 460 // The SERVER_ field should already have been written. | 460 // The SERVER_ field should already have been written. |
| 461 DCHECK_EQ(entry_response.position_in_parent(), | 461 DCHECK_EQ(entry_response.position_in_parent(), |
| 462 local_entry->Get(SERVER_POSITION_IN_PARENT)); | 462 local_entry->Get(SERVER_POSITION_IN_PARENT)); |
| 463 | 463 |
| 464 DVLOG(1) << "Response overrides local position of " |
| 465 << local_entry->Get(syncable::ID).GetServerId() |
| 466 << " from " |
| 467 << local_entry->Get(syncable::SERVER_POSITION_IN_PARENT) |
| 468 << " to " << entry_response.position_in_parent(); |
| 469 |
| 464 // We just committed successfully, so we assume that the position | 470 // We just committed successfully, so we assume that the position |
| 465 // value we got applies to the PARENT_ID we submitted. | 471 // value we got applies to the PARENT_ID we submitted. |
| 466 syncable::Id new_prev = local_entry->ComputePrevIdFromServerPosition( | 472 syncable::Id new_prev = local_entry->ComputePrevIdFromServerPosition( |
| 467 local_entry->Get(PARENT_ID)); | 473 local_entry->Get(PARENT_ID)); |
| 468 if (!local_entry->PutPredecessor(new_prev)) { | 474 if (!local_entry->PutPredecessor(new_prev)) { |
| 469 // TODO(lipalani) : Propagate the error to caller. crbug.com/100444. | 475 // TODO(lipalani) : Propagate the error to caller. crbug.com/100444. |
| 470 NOTREACHED(); | 476 NOTREACHED(); |
| 471 } | 477 } |
| 472 } | 478 } |
| 473 } | 479 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 // been recursively deleted. | 517 // been recursively deleted. |
| 512 // TODO(nick): Here, commit_message.deleted() would be more correct than | 518 // TODO(nick): Here, commit_message.deleted() would be more correct than |
| 513 // local_entry->Get(IS_DEL). For example, an item could be renamed, and then | 519 // local_entry->Get(IS_DEL). For example, an item could be renamed, and then |
| 514 // deleted during the commit of the rename. Unit test & fix. | 520 // deleted during the commit of the rename. Unit test & fix. |
| 515 if (local_entry->Get(IS_DIR) && local_entry->Get(IS_DEL)) { | 521 if (local_entry->Get(IS_DIR) && local_entry->Get(IS_DEL)) { |
| 516 deleted_folders->insert(local_entry->Get(ID)); | 522 deleted_folders->insert(local_entry->Get(ID)); |
| 517 } | 523 } |
| 518 } | 524 } |
| 519 | 525 |
| 520 } // namespace browser_sync | 526 } // namespace browser_sync |
| OLD | NEW |