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

Unified Diff: components/sync_driver/data_type_controller.h

Issue 1314903004: Sync: Refactoring DataTypeController to make the design shareable with USS datatypes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed CR comments Created 5 years, 3 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_driver/BUILD.gn ('k') | components/sync_driver/data_type_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync_driver/data_type_controller.h
diff --git a/components/sync_driver/data_type_controller.h b/components/sync_driver/data_type_controller.h
index ab6a517f39878b15bcd35db8e0c749f9453d06b0..d9635d69582f954bd047fa7267b2d0ead0701a5f 100644
--- a/components/sync_driver/data_type_controller.h
+++ b/components/sync_driver/data_type_controller.h
@@ -14,9 +14,7 @@
#include "base/memory/ref_counted_delete_on_message_loop.h"
#include "base/sequenced_task_runner_helpers.h"
#include "components/sync_driver/data_type_error_handler.h"
-#include "sync/api/sync_merge_result.h"
#include "sync/internal_api/public/base/model_type.h"
-#include "sync/internal_api/public/engine/model_safe_worker.h"
#include "sync/internal_api/public/util/unrecoverable_error_handler.h"
namespace base {
@@ -25,12 +23,11 @@ class SingleThreadTaskRunner;
namespace syncer {
class SyncError;
-struct UserShare;
+class SyncMergeResult;
}
namespace sync_driver {
-
-class ChangeProcessor;
+class BackendDataTypeConfigurer;
// Data type controllers need to be refcounted threadsafe, as they may
// need to run model associator or change processor on other threads.
@@ -78,9 +75,6 @@ class DataTypeController
typedef base::Callback<void(syncer::ModelType,
syncer::SyncError)> ModelLoadCallback;
- typedef base::Callback<void(const tracked_objects::Location& location,
- const std::string&)> DisableTypeCallback;
-
typedef std::map<syncer::ModelType,
scoped_refptr<DataTypeController> > TypeMap;
typedef std::map<syncer::ModelType, DataTypeController::State> StateMap;
@@ -104,6 +98,16 @@ class DataTypeController
// be invoked.
virtual void StartAssociating(const StartCallback& start_callback) = 0;
+ // Called by DataTypeManager to activate the controlled data type using
+ // one of the implementation specific methods provided by the |configurer|.
+ // This is called (on UI thread) after the data type configuration has
+ // completed successfully.
+ virtual void ActivateDataType(BackendDataTypeConfigurer* configurer) = 0;
+
+ // Called by DataTypeManager to deactivate the controlled data type.
+ // See comments for ModelAssociationManager::OnSingleDataTypeWillStop.
+ virtual void DeactivateDataType(BackendDataTypeConfigurer* configurer) = 0;
+
// Synchronously stops the data type. If StartAssociating has already been
// called but is not done yet it will be aborted. Similarly if LoadModels
// has not completed it will also be aborted.
@@ -120,15 +124,6 @@ class DataTypeController
// Name of this data type. For logging purposes only.
virtual std::string name() const = 0;
- // The model safe group of this data type. This should reflect the
- // thread that should be used to modify the data type's native
- // model.
- virtual syncer::ModelSafeGroup model_safe_group() const = 0;
-
- // Access to the ChangeProcessor for the type being controlled by |this|.
- // Returns NULL if the ChangeProcessor isn't created or connected.
- virtual ChangeProcessor* GetChangeProcessor() const = 0;
-
// Current state of the data type controller.
virtual State state() const = 0;
@@ -139,10 +134,6 @@ class DataTypeController
const std::string& message,
syncer::ModelType type) override;
- // Called when the sync backend has initialized. |share| is the
- // UserShare handle to associate model data with.
- void OnUserShareReady(syncer::UserShare* share);
-
// Whether the DataTypeController is ready to start. This is useful if the
// datatype itself must make the decision about whether it should be enabled
// at all (and therefore whether the initial download of the sync data for
@@ -154,8 +145,9 @@ class DataTypeController
friend class base::RefCountedDeleteOnMessageLoop<DataTypeController>;
friend class base::DeleteHelper<DataTypeController>;
- DataTypeController(scoped_refptr<base::SingleThreadTaskRunner> ui_thread,
- const base::Closure& error_callback);
+ DataTypeController(
+ const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread,
+ const base::Closure& error_callback);
// If the DTC is waiting for models to load, once the models are
// loaded the datatype service will call this function on DTC to let
@@ -164,14 +156,9 @@ class DataTypeController
~DataTypeController() override;
- syncer::UserShare* user_share() const;
-
// The callback that will be invoked when an unrecoverable error occurs.
// TODO(sync): protected for use by legacy controllers.
base::Closure error_callback_;
-
- private:
- syncer::UserShare* user_share_;
};
} // namespace sync_driver
« no previous file with comments | « components/sync_driver/BUILD.gn ('k') | components/sync_driver/data_type_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698