Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Unified Diff: components/sync/model_impl/shared_model_type_processor.cc

Issue 2864713002: [USS] Add function for update storage key for processor (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698