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

Unified Diff: components/sync/model/model_type_change_processor.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_error.cc ('k') | components/sync/model/model_type_debug_info.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b001832855e7cbb246aaa2463c023b32ab8a4bdb..838449815b13ca75cf71e38a46aedd2ddf62bf30 100644
--- a/components/sync/model/model_type_change_processor.h
+++ b/components/sync/model/model_type_change_processor.h
@@ -8,11 +8,12 @@
#include <memory>
#include <string>
+#include "base/location.h"
#include "components/sync/base/model_type.h"
#include "components/sync/engine/activation_context.h"
#include "components/sync/model/data_type_error_handler.h"
#include "components/sync/model/entity_data.h"
-#include "components/sync/model/sync_error_factory.h"
+#include "components/sync/model/model_error.h"
namespace syncer {
@@ -23,7 +24,7 @@ class SyncError;
// Interface used by the ModelTypeSyncBridge to inform sync of local
// changes.
-class ModelTypeChangeProcessor : public SyncErrorFactory {
+class ModelTypeChangeProcessor {
public:
typedef base::Callback<void(SyncError, std::unique_ptr<ActivationContext>)>
StartCallback;
@@ -34,7 +35,7 @@ class ModelTypeChangeProcessor : public SyncErrorFactory {
ModelTypeSyncBridge* bridge);
ModelTypeChangeProcessor();
- ~ModelTypeChangeProcessor() override;
+ virtual ~ModelTypeChangeProcessor();
// Inform the processor of a new or updated entity. The |entity_data| param
// does not need to be fully set, but it should at least have specifics and
@@ -48,10 +49,10 @@ class ModelTypeChangeProcessor : public SyncErrorFactory {
virtual void Delete(const std::string& storage_key,
MetadataChangeList* metadata_change_list) = 0;
- // Accept the initial sync metadata loaded by the bridge. This should be
- // called as soon as the metadata is available to the bridge.
- virtual void OnMetadataLoaded(SyncError error,
- std::unique_ptr<MetadataBatch> batch) = 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;
// 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
@@ -71,6 +72,17 @@ class ModelTypeChangeProcessor : public SyncErrorFactory {
// 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.
virtual bool IsTrackingMetadata() = 0;
+
+ // Report an error in the model to sync. Should be called for any persistence
+ // or consistency error the bridge encounters outside of a method that allows
+ // returning a ModelError directly. Outstanding callbacks are not expected to
+ // be called after an error. This will result in sync being temporarily
+ // disabled for the model type (generally until the next restart).
+ virtual void ReportError(const ModelError& error) = 0;
+
+ // A convenience form of the above.
+ virtual void ReportError(const tracked_objects::Location& location,
+ const std::string& message) = 0;
};
} // namespace syncer
« no previous file with comments | « components/sync/model/model_error.cc ('k') | components/sync/model/model_type_debug_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698