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

Unified Diff: components/sync/model/model_type_change_processor.h

Issue 2621373004: [Sync] Renamed OnMetadataLoaded to ModelReadyToSync. (Closed)
Patch Set: Rebase. Created 3 years, 11 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/model_type_change_processor.h
diff --git a/components/sync/model/model_type_change_processor.h b/components/sync/model/model_type_change_processor.h
index 1f2885b5c0d311c0a6d6f1228543ae05de6d8f08..f26ab6120147dd85cedee6bbc6a9e39c810fcc13 100644
--- a/components/sync/model/model_type_change_processor.h
+++ b/components/sync/model/model_type_change_processor.h
@@ -21,8 +21,7 @@ class MetadataBatch;
class MetadataChangeList;
class ModelTypeSyncBridge;
-// Interface used by the ModelTypeSyncBridge to inform sync of local
-// changes.
+// Interface used by the ModelTypeSyncBridge to inform sync of local changes.
class ModelTypeChangeProcessor {
public:
typedef base::Callback<void(std::unique_ptr<ActivationContext>)>
@@ -48,10 +47,13 @@ class ModelTypeChangeProcessor {
virtual void Delete(const std::string& storage_key,
MetadataChangeList* metadata_change_list) = 0;
- // Accept the initial sync metadata loaded by the bridge. This must be called
- // by the bridge for syncing to begin for this model type. If an error occurs,
- // call ReportError instead of this.
- virtual void OnMetadataLoaded(std::unique_ptr<MetadataBatch> batch) = 0;
+ // The bridge is expected to call this exactly once unless it encounters an
+ // error. Ideally ModelReadyToSync() is called as soon as possible during
+ // initialization, and must be called before invoking either Put() or
+ // Delete(). The bridge needs to be able to synchronously handle
+ // MergeSyncData() and ApplySyncChanges() after calling ModelReadyToSync(). If
+ // an error is encountered, calling ReportError() instead is sufficient.
+ virtual void ModelReadyToSync(std::unique_ptr<MetadataBatch> batch) = 0;
// Indicates that sync wants to connect a sync worker to this processor. Once
// the processor has metadata from the bridge, it will pass the info needed
@@ -68,7 +70,8 @@ class ModelTypeChangeProcessor {
// Returns a boolean representing whether the processor's metadata is
// currently up to date and accurately tracking the model type's data. If
- // false, calls to Put and Delete will no-op and can be omitted by bridge.
+ // false, and ModelReadyToSync() has already been called, then Put and Delete
+ // will no-op and can be omitted by bridge.
virtual bool IsTrackingMetadata() = 0;
// Report an error in the model to sync. Should be called for any persistence
« no previous file with comments | « components/sync/model/fake_model_type_change_processor.cc ('k') | components/sync/model/model_type_sync_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698