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

Unified Diff: components/sync/api/model_type_service.h

Issue 2222373003: [Sync] Adding storage key concept for ModelTypeServices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments and method name fixes. Created 4 years, 4 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/api/model_type_service.h
diff --git a/components/sync/api/model_type_service.h b/components/sync/api/model_type_service.h
index 9b2bec714d18b7fcf0dcf8e1d46f093866a11cc6..4b15666f8dd048694327107a3a04e60594d0e663 100644
--- a/components/sync/api/model_type_service.h
+++ b/components/sync/api/model_type_service.h
@@ -34,7 +34,7 @@ class SYNC_EXPORT ModelTypeService {
public:
typedef base::Callback<void(syncer::SyncError, std::unique_ptr<DataBatch>)>
DataCallback;
- typedef std::vector<std::string> ClientTagList;
+ typedef std::vector<std::string> StorageKeyList;
typedef base::Callback<std::unique_ptr<ModelTypeChangeProcessor>(
syncer::ModelType type,
ModelTypeService* service)>
@@ -75,15 +75,28 @@ class SYNC_EXPORT ModelTypeService {
std::unique_ptr<MetadataChangeList> metadata_change_list,
EntityChangeList entity_changes) = 0;
- // Asynchronously retrieve the corresponding sync data for |client_tags|.
- virtual void GetData(ClientTagList client_tags, DataCallback callback) = 0;
+ // Asynchronously retrieve the corresponding sync data for |storage_keys|.
+ virtual void GetData(StorageKeyList storage_keys, DataCallback callback) = 0;
// Asynchronously retrieve all of the local sync data.
virtual void GetAllData(DataCallback callback) = 0;
- // Get or generate a client tag for |entity_data|.
+ // Get or generate a client tag for |entity_data|. This must be the same tag
+ // that was/would have been generated in the SyncableService/Directory world.
maxbogue 2016/08/10 23:56:02 "world for backward-compatibility with pre-USS cli
skym 2016/08/11 16:28:47 Done.
+ // The only time this theoretically needs to be called is on the creation of
+ // local data, however we also call and verify on remote data to make sure the
maxbogue 2016/08/10 23:56:02 "however it is also used to verify the hash of rem
skym 2016/08/11 16:28:47 Done.
+ // hash we would generate is the same. If a data type was never launched
+ // pre-USS, then method does not need to be different from GetStorageKey().
virtual std::string GetClientTag(const EntityData& entity_data) = 0;
+ // Get or generate a storage key for |entity_data|. This will only ever be
+ // called once when first encountering a remote entity. Local changes should
maxbogue 2016/08/10 23:56:02 "Local changes will provide their storage keys dir
skym 2016/08/11 16:28:47 Done.
+ // have their storage keys proactivly supplied to the processor instead of
+ // using this method. Theoretically this function doesn't need to be stable
+ // across multiple calls on the same or different clients, but to keep things
+ // simple, it probably should be.
+ virtual std::string GetStorageKey(const EntityData& entity_data) = 0;
+
// Overridable notification for when the processor is set. This is typically
// when the service should start loading metadata and then subsequently giving
// it to the processor.

Powered by Google App Engine
This is Rietveld 408576698