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

Unified Diff: components/sync_driver/model_association_manager.h

Issue 317453002: sync: cut a few profile deps from DataTypeControllers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move OnUserShareReady Created 6 years, 6 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_driver/model_association_manager.h
diff --git a/components/sync_driver/model_association_manager.h b/components/sync_driver/model_association_manager.h
index 89ad4299b8afb28159bdd930eb13fabd15008f4e..8b53940e07d6abac5033fcd7e6517191dabb7e6a 100644
--- a/components/sync_driver/model_association_manager.h
+++ b/components/sync_driver/model_association_manager.h
@@ -25,27 +25,37 @@ class DataTypeController;
// |ModelAssociationManager| association functions are async. The results of
// those operations are passed back via this interface.
-class ModelAssociationResultProcessor {
+class ModelAssociationManagerDelegate {
public:
+ // Called when model association (MergeDataAndStartSyncing) has completed
+ // for |type|, regardless of success or failure.
virtual void OnSingleDataTypeAssociationDone(
syncer::ModelType type,
const syncer::DataTypeAssociationStats& association_stats) = 0;
+
+ // Called when the ModelAssociationManager has decided it must stop |type|,
+ // likely because it is no longer a desired data type or sync is shutting
+ // down.
+ virtual void OnSingleDataTypeWillStop(syncer::ModelType type) = 0;
+
+ // Called when the ModelAssociationManager has tried to perform model
+ // association for all desired types and has nothing left to do.
virtual void OnModelAssociationDone(
const DataTypeManager::ConfigureResult& result) = 0;
- virtual ~ModelAssociationResultProcessor() {}
+ virtual ~ModelAssociationManagerDelegate() {}
};
// The class that is responsible for model association.
class ModelAssociationManager {
public:
ModelAssociationManager(const DataTypeController::TypeMap* controllers,
- ModelAssociationResultProcessor* processor);
+ ModelAssociationManagerDelegate* delegate);
virtual ~ModelAssociationManager();
// Initializes the state to do the model association in future. This
// should be called before communicating with sync server. A subsequent call
// of Initialize is only allowed if the ModelAssociationManager has invoked
- // |OnModelAssociationDone| on the |ModelAssociationResultProcessor|. After
+ // |OnModelAssociationDone| on the |ModelAssociationManagerDelegate|. After
// this call, there should be several calls to StartAssociationAsync()
// to associate subset of |desired_types|.
void Initialize(syncer::ModelTypeSet desired_types);
@@ -101,9 +111,12 @@ class ModelAssociationManager {
void AppendToFailedDatatypesAndLogError(const syncer::SyncError& error);
// Called when all requested types are associated or association times out.
- // Notify |result_processor_| of configuration results.
+ // Notify |delegate_| of configuration results.
void ModelAssociationDone();
+ // A helper to stop an individual datatype.
+ void StopDatatype(DataTypeController* dtc);
+
State state_;
// Data types that are enabled.
@@ -143,7 +156,7 @@ class ModelAssociationManager {
const DataTypeController::TypeMap* controllers_;
// The processor in charge of handling model association results.
- ModelAssociationResultProcessor* result_processor_;
+ ModelAssociationManagerDelegate* delegate_;
// Timer to track and limit how long a datatype takes to model associate.
base::OneShotTimer<ModelAssociationManager> timer_;
« no previous file with comments | « components/sync_driver/data_type_manager_impl_unittest.cc ('k') | components/sync_driver/model_association_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698