summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/glue/model_association_manager.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/sync/glue/model_association_manager.h')
-rw-r--r--chrome/browser/sync/glue/model_association_manager.h46
1 files changed, 17 insertions, 29 deletions
diff --git a/chrome/browser/sync/glue/model_association_manager.h b/chrome/browser/sync/glue/model_association_manager.h
index 33aad48..eff88c5 100644
--- a/chrome/browser/sync/glue/model_association_manager.h
+++ b/chrome/browser/sync/glue/model_association_manager.h
@@ -11,7 +11,7 @@
#include "base/timer.h"
#include "chrome/browser/sync/glue/data_type_manager.h"
-#include "sync/internal_api/public/data_type_debug_info_listener.h"
+#include "sync/internal_api/public/data_type_association_stats.h"
#include "sync/internal_api/public/util/weak_handle.h"
// |ModelAssociationManager| does the heavy lifting for doing the actual model
@@ -27,6 +27,9 @@ class DataTypeController;
// those operations are passed back via this interface.
class ModelAssociationResultProcessor {
public:
+ virtual void OnSingleDataTypeAssociationDone(
+ syncer::ModelType type,
+ const syncer::DataTypeAssociationStats& association_stats) = 0;
virtual void OnModelAssociationDone(
const DataTypeManager::ConfigureResult& result) = 0;
virtual ~ModelAssociationResultProcessor() {}
@@ -41,32 +44,25 @@ class ModelAssociationResultProcessor {
// The class that is responsible for model association.
class ModelAssociationManager {
public:
- ModelAssociationManager(
- const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&
- debug_info_listener,
- const DataTypeController::TypeMap* controllers,
- ModelAssociationResultProcessor* processor);
+ ModelAssociationManager(const DataTypeController::TypeMap* controllers,
+ ModelAssociationResultProcessor* processor);
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|.
+ // |OnModelAssociationDone| on the |ModelAssociationResultProcessor|. After
+ // this call, there should be several calls to StartAssociationAsync()
+ // to associate subset of |desired_types|.
void Initialize(syncer::ModelTypeSet desired_types);
// Can be called at any time. Synchronously stops all datatypes.
void Stop();
- // Called before StartAssociationAsync() to flag types that are synced
- // for the first time. For those types, |download_time| is recorded in their
- // association stats.
- void SetFirstSyncTypesAndDownloadTime(const syncer::ModelTypeSet& types,
- const base::TimeDelta& download_time);
-
- // Should only be called after Initialize.
- // Starts the actual association. When this is completed
- // |OnModelAssociationDone| would be called invoked.
- void StartAssociationAsync();
+ // Should only be called after Initialize to start the actual association.
+ // |types_to_associate| should be subset of |desired_types| in Initialize().
+ // When this is completed, |OnModelAssociationDone| will be invoked.
+ void StartAssociationAsync(const syncer::ModelTypeSet& types_to_associate);
// It is valid to call this only when we are initialized to configure
// but we have not started the configuration.(i.e., |Initialize| has
@@ -129,9 +125,11 @@ class ModelAssociationManager {
syncer::ModelTypeSet GetTypesWaitingToLoad();
-
State state_;
- syncer::ModelTypeSet desired_types_;
+
+ // Data types currently being associated.
+ syncer::ModelTypeSet associating_types_;
+
std::list<syncer::SyncError> failed_datatypes_info_;
std::map<syncer::ModelType, int> start_order_;
@@ -183,18 +181,8 @@ class ModelAssociationManager {
// Timer to track and limit how long a datatype takes to model associate.
base::OneShotTimer<ModelAssociationManager> timer_;
- // Sync's datatype debug info listener, which we pass model association
- // statistics to.
- const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>
- debug_info_listener_;
-
base::WeakPtrFactory<ModelAssociationManager> weak_ptr_factory_;
- // Types that are synced for the first time and time spent on downloading
- // their data.
- syncer::ModelTypeSet first_sync_types_;
- base::TimeDelta first_sync_download_time_;
-
DISALLOW_COPY_AND_ASSIGN(ModelAssociationManager);
};
} // namespace browser_sync