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

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

Issue 2618483003: [Sync] Introduce ModelError for USS error handling. (Closed)
Patch Set: Address comments. 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
« no previous file with comments | « components/sync/model/model_type_store.h ('k') | components/sync/model/model_type_sync_bridge.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/model/model_type_sync_bridge.h
diff --git a/components/sync/model/model_type_sync_bridge.h b/components/sync/model/model_type_sync_bridge.h
index 8c236ccd70f7678db04b0e540d9846975ceeda2e..fb597e6a51a1bf0986889068850350656fdee000 100644
--- a/components/sync/model/model_type_sync_bridge.h
+++ b/components/sync/model/model_type_sync_bridge.h
@@ -16,25 +16,25 @@
#include "components/sync/model/data_type_error_handler.h"
#include "components/sync/model/entity_change.h"
#include "components/sync/model/entity_data.h"
+#include "components/sync/model/model_error.h"
#include "components/sync/model/model_type_change_processor.h"
-#include "components/sync/model/sync_error.h"
namespace syncer {
class DataBatch;
class MetadataChangeList;
-// Interface implemented by model types to receive updates from sync via the
-// SharedModelTypeProcessor. Provides a way for sync to update the data and
+// Interface implemented by model types to receive updates from sync via a
+// ModelTypeChangeProcessor. Provides a way for sync to update the data and
// metadata for entities, as well as the model type state. Sync bridge
-// implementations have the responsibility of providing thier change_processor()
-// with metadata through ModelTypeChangeProcessor::OnMetadataLoaded() as soon as
-// possible. Sync will wait for this method to be called, and afterwards it will
-// start calling into the bridge.
+// implementations must provide their change_processor() with metadata through
+// OnMetadataLoaded() as soon as possible. Once this is called, sync will
+// immediately begin locally tracking changes and can start syncing with the
+// server soon afterward. If an error occurs during startup, the processor's
+// ReportError() method should be called instead of OnMetadataLoaded().
class ModelTypeSyncBridge : public base::SupportsWeakPtr<ModelTypeSyncBridge> {
public:
- typedef base::Callback<void(SyncError, std::unique_ptr<DataBatch>)>
- DataCallback;
+ typedef base::Callback<void(std::unique_ptr<DataBatch>)> DataCallback;
typedef std::vector<std::string> StorageKeyList;
typedef base::Callback<std::unique_ptr<ModelTypeChangeProcessor>(
ModelType type,
@@ -63,7 +63,7 @@ class ModelTypeSyncBridge : public base::SupportsWeakPtr<ModelTypeSyncBridge> {
// combine all change atomically, should save the metadata after the data
// changes, so that this merge will be re-driven by sync if is not completely
// saved during the current run.
- virtual SyncError MergeSyncData(
+ virtual ModelError MergeSyncData(
std::unique_ptr<MetadataChangeList> metadata_change_list,
EntityDataMap entity_data_map) = 0;
@@ -72,14 +72,18 @@ class ModelTypeSyncBridge : public base::SupportsWeakPtr<ModelTypeSyncBridge> {
// |metadata_change_list| in case when some of the data changes are filtered
// out, or even be empty in case when a commit confirmation is processed and
// only the metadata needs to persisted.
- virtual SyncError ApplySyncChanges(
+ virtual ModelError ApplySyncChanges(
std::unique_ptr<MetadataChangeList> metadata_change_list,
EntityChangeList entity_changes) = 0;
// Asynchronously retrieve the corresponding sync data for |storage_keys|.
+ // |callback| should be invoked if the operation is successful, otherwise
+ // the processor's ReportError method should be called.
virtual void GetData(StorageKeyList storage_keys, DataCallback callback) = 0;
- // Asynchronously retrieve all of the local sync data.
+ // Asynchronously retrieve all of the local sync data. |callback| should be
+ // invoked if the operation is successful, otherwise the processor's
+ // ReportError method should be called.
virtual void GetAllData(DataCallback callback) = 0;
// Get or generate a client tag for |entity_data|. This must be the same tag
« no previous file with comments | « components/sync/model/model_type_store.h ('k') | components/sync/model/model_type_sync_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698