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

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

Issue 2915763005: [Sync] Implement support for updating storage key for new entities (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.h
diff --git a/components/sync/model_impl/shared_model_type_processor.h b/components/sync/model_impl/shared_model_type_processor.h
index 62c136fa5b786369807c7c85b6f2ad9f4d8626fc..306a7c10c124bfdfaf5f58f689eff1b608465109 100644
--- a/components/sync/model_impl/shared_model_type_processor.h
+++ b/components/sync/model_impl/shared_model_type_processor.h
@@ -57,8 +57,8 @@ class SharedModelTypeProcessor : public ModelTypeProcessor,
MetadataChangeList* metadata_change_list) override;
void Delete(const std::string& storage_key,
MetadataChangeList* metadata_change_list) override;
- void UpdateStorageKey(const std::string& old_storage_key,
- const std::string& new_storage_key,
+ void UpdateStorageKey(const EntityData& entity_data,
+ const std::string& storage_key,
MetadataChangeList* metadata_change_list) override;
void ModelReadyToSync(std::unique_ptr<MetadataBatch> batch) override;
void OnSyncStarting(const ModelErrorHandler& error_handler,
@@ -146,6 +146,9 @@ class SharedModelTypeProcessor : public ModelTypeProcessor,
// Version of the above that generates a tag for |data|.
ProcessorEntityTracker* CreateEntity(const EntityData& data);
+ // Returns true if all processor entity trackers have non-empty storage keys.
+ bool AllStorageKeysPopulated() const;
+
/////////////////////
// Processor state //
/////////////////////
@@ -209,6 +212,10 @@ class SharedModelTypeProcessor : public ModelTypeProcessor,
// define and can understand more easily. All of the sync machinery wants to
// use client tag hash. This mapping allows us to convert from storage key to
// client tag hash. The other direction can use |entities_|.
+ // Entity is not included in this map when the bridge doesn't support
skym 2017/05/31 19:53:12 This comment seems misleading. They're only not i
pavely 2017/06/02 18:23:46 Is this one better?
skym 2017/06/02 23:07:56 Yes! Thanks.
+ // GetStorageKey(). In this case the bridge is responsible for calling
+ // UpdateStorageKey() as part of processing entity in
+ // MergeSyncData/ApplySyncChanges.
std::map<std::string, std::string> storage_key_to_tag_hash_;
// WeakPtrFactory for this processor which will be sent to sync thread.

Powered by Google App Engine
This is Rietveld 408576698