| OLD | NEW |
| 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 "sync/engine/process_commit_response_command.h" | 5 #include "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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 DVLOG(1) << " ID changed while committing an old entry. " | 329 DVLOG(1) << " ID changed while committing an old entry. " |
| 330 << pre_commit_id << " became " << entry_response.id() << "."; | 330 << pre_commit_id << " became " << entry_response.id() << "."; |
| 331 } | 331 } |
| 332 MutableEntry same_id(trans, GET_BY_ID, entry_response.id()); | 332 MutableEntry same_id(trans, GET_BY_ID, entry_response.id()); |
| 333 // We should trap this before this function. | 333 // We should trap this before this function. |
| 334 if (same_id.good()) { | 334 if (same_id.good()) { |
| 335 LOG(ERROR) << "ID clash with id " << entry_response.id() | 335 LOG(ERROR) << "ID clash with id " << entry_response.id() |
| 336 << " during commit " << same_id; | 336 << " during commit " << same_id; |
| 337 return false; | 337 return false; |
| 338 } | 338 } |
| 339 SyncerUtil::ChangeEntryIDAndUpdateChildren( | 339 ChangeEntryIDAndUpdateChildren(trans, local_entry, entry_response.id()); |
| 340 trans, local_entry, entry_response.id()); | |
| 341 DVLOG(1) << "Changing ID to " << entry_response.id(); | 340 DVLOG(1) << "Changing ID to " << entry_response.id(); |
| 342 } | 341 } |
| 343 return true; | 342 return true; |
| 344 } | 343 } |
| 345 | 344 |
| 346 void ProcessCommitResponseCommand::UpdateServerFieldsAfterCommit( | 345 void ProcessCommitResponseCommand::UpdateServerFieldsAfterCommit( |
| 347 const sync_pb::SyncEntity& committed_entry, | 346 const sync_pb::SyncEntity& committed_entry, |
| 348 const CommitResponse_EntryResponse& entry_response, | 347 const CommitResponse_EntryResponse& entry_response, |
| 349 syncable::MutableEntry* local_entry) { | 348 syncable::MutableEntry* local_entry) { |
| 350 | 349 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 // been recursively deleted. | 472 // been recursively deleted. |
| 474 // TODO(nick): Here, commit_message.deleted() would be more correct than | 473 // TODO(nick): Here, commit_message.deleted() would be more correct than |
| 475 // local_entry->Get(IS_DEL). For example, an item could be renamed, and then | 474 // local_entry->Get(IS_DEL). For example, an item could be renamed, and then |
| 476 // deleted during the commit of the rename. Unit test & fix. | 475 // deleted during the commit of the rename. Unit test & fix. |
| 477 if (local_entry->Get(IS_DIR) && local_entry->Get(IS_DEL)) { | 476 if (local_entry->Get(IS_DIR) && local_entry->Get(IS_DEL)) { |
| 478 deleted_folders->insert(local_entry->Get(ID)); | 477 deleted_folders->insert(local_entry->Get(ID)); |
| 479 } | 478 } |
| 480 } | 479 } |
| 481 | 480 |
| 482 } // namespace browser_sync | 481 } // namespace browser_sync |
| OLD | NEW |