Chromium Code Reviews| Index: components/sync/model_impl/shared_model_type_processor.cc |
| diff --git a/components/sync/model_impl/shared_model_type_processor.cc b/components/sync/model_impl/shared_model_type_processor.cc |
| index f5713235b0bdd690124dda750dee4618346ab90f..0c770742b30cbea1f890571efda264917a2e8bd6 100644 |
| --- a/components/sync/model_impl/shared_model_type_processor.cc |
| +++ b/components/sync/model_impl/shared_model_type_processor.cc |
| @@ -257,6 +257,29 @@ void SharedModelTypeProcessor::Delete( |
| FlushPendingCommitRequests(); |
| } |
| +void SharedModelTypeProcessor::UpdateStorageKey( |
| + const std::string& old_storage_key, |
| + const std::string& new_storage_key, |
| + MetadataChangeList* metadata_change_list) { |
| + ProcessorEntityTracker* entity = GetEntityForStorageKey(old_storage_key); |
| + if (entity == nullptr) { |
| + DLOG(WARNING) << "Attempted to update missing item." |
| + << " storage key: " << old_storage_key; |
| + return; |
| + } |
| + |
| + entity->SetStorageKey(new_storage_key); |
| + |
| + // Update storage key to tag hash map |
|
pavely
2017/05/09 00:49:24
nit: End comment sentences with a dot. (the same f
Gang Wu
2017/05/09 22:33:15
Done.
|
| + storage_key_to_tag_hash_.erase(old_storage_key); |
| + storage_key_to_tag_hash_[new_storage_key] = |
| + entity->metadata().client_tag_hash(); |
| + |
| + // Update metadata store |
| + metadata_change_list->ClearMetadata(old_storage_key); |
| + metadata_change_list->UpdateMetadata(new_storage_key, entity->metadata()); |
| +} |
| + |
| void SharedModelTypeProcessor::FlushPendingCommitRequests() { |
| CommitRequestDataList commit_requests; |