diff options
Diffstat (limited to 'components/sync_driver')
9 files changed, 33 insertions, 3 deletions
diff --git a/components/sync_driver/backend_data_type_configurer.h b/components/sync_driver/backend_data_type_configurer.h index ac3128d..dc91e34 100644 --- a/components/sync_driver/backend_data_type_configurer.h +++ b/components/sync_driver/backend_data_type_configurer.h @@ -10,9 +10,12 @@ #include "base/callback.h" #include "sync/internal_api/public/base/model_type.h" #include "sync/internal_api/public/configure_reason.h" +#include "sync/internal_api/public/engine/model_safe_worker.h" namespace browser_sync { +class ChangeProcessor; + // The DataTypeConfigurer interface abstracts out the action of // configuring a set of new data types and cleaning up after a set of // removed data types. @@ -55,6 +58,17 @@ class BackendDataTypeConfigurer { static syncer::ModelTypeSet GetDataTypesInState( DataTypeConfigState state, const DataTypeConfigStateMap& state_map); + // Activates change processing for the given data type. This must + // be called synchronously with the data type's model association so + // no changes are dropped between model association and change + // processor activation. + virtual void ActivateDataType( + syncer::ModelType type, syncer::ModelSafeGroup group, + ChangeProcessor* change_processor) = 0; + + // Deactivates change processing for the given data type. + virtual void DeactivateDataType(syncer::ModelType type) = 0; + // Set state of |types| in |state_map| to |state|. static void SetDataTypesState(DataTypeConfigState state, syncer::ModelTypeSet types, diff --git a/components/sync_driver/data_type_controller.cc b/components/sync_driver/data_type_controller.cc index 9e1932b..aa975d2 100644 --- a/components/sync_driver/data_type_controller.cc +++ b/components/sync_driver/data_type_controller.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "components/sync_driver/data_type_controller.h" + #include "sync/internal_api/public/base/model_type.h" #include "sync/util/data_type_histogram.h" diff --git a/components/sync_driver/data_type_controller.h b/components/sync_driver/data_type_controller.h index 633f433..ebc6c6fb 100644 --- a/components/sync_driver/data_type_controller.h +++ b/components/sync_driver/data_type_controller.h @@ -25,6 +25,8 @@ class SyncError; namespace browser_sync { +class ChangeProcessor; + // Data type controllers need to be refcounted threadsafe, as they may // need to run model associator or change processor on other threads. class DataTypeController @@ -107,6 +109,10 @@ class DataTypeController // 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; diff --git a/components/sync_driver/fake_data_type_controller.cc b/components/sync_driver/fake_data_type_controller.cc index d89d411..1d588c4 100644 --- a/components/sync_driver/fake_data_type_controller.cc +++ b/components/sync_driver/fake_data_type_controller.cc @@ -118,12 +118,14 @@ std::string FakeDataTypeController::name() const { return ModelTypeToString(type_); } -// This isn't called by the DTM. syncer::ModelSafeGroup FakeDataTypeController::model_safe_group() const { - ADD_FAILURE(); return syncer::GROUP_PASSIVE; } +ChangeProcessor* FakeDataTypeController::GetChangeProcessor() const { + return NULL; +} + DataTypeController::State FakeDataTypeController::state() const { return state_; } diff --git a/components/sync_driver/fake_data_type_controller.h b/components/sync_driver/fake_data_type_controller.h index 2292c4f..643d524 100644 --- a/components/sync_driver/fake_data_type_controller.h +++ b/components/sync_driver/fake_data_type_controller.h @@ -39,6 +39,8 @@ class FakeDataTypeController : public DataTypeController { virtual syncer::ModelSafeGroup model_safe_group() const OVERRIDE; + virtual ChangeProcessor* GetChangeProcessor() const OVERRIDE; + virtual State state() const OVERRIDE; virtual void OnSingleDatatypeUnrecoverableError( diff --git a/components/sync_driver/generic_change_processor.cc b/components/sync_driver/generic_change_processor.cc index 49889a6..75ed373 100644 --- a/components/sync_driver/generic_change_processor.cc +++ b/components/sync_driver/generic_change_processor.cc @@ -720,7 +720,6 @@ bool GenericChangeProcessor::CryptoReadyIfNecessary(syncer::ModelType type) { } void GenericChangeProcessor::StartImpl() { - DCHECK(CalledOnValidThread()); } syncer::UserShare* GenericChangeProcessor::share_handle() const { diff --git a/components/sync_driver/generic_change_processor_factory.cc b/components/sync_driver/generic_change_processor_factory.cc index 4ce66ed..8d9596b 100644 --- a/components/sync_driver/generic_change_processor_factory.cc +++ b/components/sync_driver/generic_change_processor_factory.cc @@ -20,6 +20,7 @@ GenericChangeProcessorFactory::CreateGenericChangeProcessor( const base::WeakPtr<syncer::SyncableService>& local_service, const base::WeakPtr<syncer::SyncMergeResult>& merge_result, scoped_ptr<syncer::AttachmentService> attachment_service) { + DCHECK(user_share); return make_scoped_ptr(new GenericChangeProcessor( error_handler, local_service, diff --git a/components/sync_driver/proxy_data_type_controller.cc b/components/sync_driver/proxy_data_type_controller.cc index 23a78a4..918617a 100644 --- a/components/sync_driver/proxy_data_type_controller.cc +++ b/components/sync_driver/proxy_data_type_controller.cc @@ -48,6 +48,10 @@ syncer::ModelSafeGroup ProxyDataTypeController::model_safe_group() const { return syncer::GROUP_PASSIVE; } +ChangeProcessor* ProxyDataTypeController::GetChangeProcessor() const { + return NULL; +} + std::string ProxyDataTypeController::name() const { // For logging only. return syncer::ModelTypeToString(type()); diff --git a/components/sync_driver/proxy_data_type_controller.h b/components/sync_driver/proxy_data_type_controller.h index 98a9c15..b5e3cf2 100644 --- a/components/sync_driver/proxy_data_type_controller.h +++ b/components/sync_driver/proxy_data_type_controller.h @@ -27,6 +27,7 @@ class ProxyDataTypeController : public DataTypeController { virtual void Stop() OVERRIDE; virtual syncer::ModelType type() const OVERRIDE; virtual syncer::ModelSafeGroup model_safe_group() const OVERRIDE; + virtual ChangeProcessor* GetChangeProcessor() const OVERRIDE; virtual std::string name() const OVERRIDE; virtual State state() const OVERRIDE; |