summaryrefslogtreecommitdiffstats
path: root/components/sync_driver
diff options
context:
space:
mode:
authortim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-09 02:15:35 +0000
committertim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-09 02:15:35 +0000
commit22d2209e2359574649fe2ce52f3290c931b19209 (patch)
treef4b35bd3b3def21e5af69a28c56e31e88b8d8f5e /components/sync_driver
parentfd20b904a6e8c2de2321fd560aaf8a02cc941a1a (diff)
downloadchromium_src-22d2209e2359574649fe2ce52f3290c931b19209.zip
chromium_src-22d2209e2359574649fe2ce52f3290c931b19209.tar.gz
chromium_src-22d2209e2359574649fe2ce52f3290c931b19209.tar.bz2
sync: remove c/b/s dependencies from SharedChangeProcessor
*Moves ActivateDataType call to DataTypeManagerImpl via BackendDataTypeConfigurer. Removed from PSS. *Pass UserShare directly to Connect instead of PSS. *Paves the way for moving SCP to sync_driver. Note that previously, ActivateDataType was called from model-safe thread, whereas it is now invoked on the UI for non-control types. Because model-association only happens when the syncer is in configuration mode (until StartSyncingWithServer is called), this should be safe to do from the UI thread before telling the syncer to start. BUG=339726 Review URL: https://codereview.chromium.org/267713009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269150 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/sync_driver')
-rw-r--r--components/sync_driver/backend_data_type_configurer.h14
-rw-r--r--components/sync_driver/data_type_controller.cc1
-rw-r--r--components/sync_driver/data_type_controller.h6
-rw-r--r--components/sync_driver/fake_data_type_controller.cc6
-rw-r--r--components/sync_driver/fake_data_type_controller.h2
-rw-r--r--components/sync_driver/generic_change_processor.cc1
-rw-r--r--components/sync_driver/generic_change_processor_factory.cc1
-rw-r--r--components/sync_driver/proxy_data_type_controller.cc4
-rw-r--r--components/sync_driver/proxy_data_type_controller.h1
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;