summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-01 06:21:03 +0000
committerrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-01 06:21:03 +0000
commit44eda8f2d61ea6c8785f3bd007dc644c26d543cd (patch)
treea6a2f053a72754c591615c66d230a33d62ffd98a
parent5c35c28f15bfb1291ddb7c34ce1252197d46ff94 (diff)
downloadchromium_src-44eda8f2d61ea6c8785f3bd007dc644c26d543cd.zip
chromium_src-44eda8f2d61ea6c8785f3bd007dc644c26d543cd.tar.gz
chromium_src-44eda8f2d61ea6c8785f3bd007dc644c26d543cd.tar.bz2
sync: Add NonBlockingDataTypeManager
The new class manages the set of NonBlockingDataTypeControllers. Its logic could have fit into the ProfileSyncService, but the code is a bit cleaner if we factor it out into a separate class. This CL does actually instantiate and make use of the NonBlockingDataTypeManager, so it is not entirely a no-op. However, without any registered non-blocking types, there will be no NonBlockingDataTypeControllers for it to manage, so its functionality will be limited. BUG=351005 Review URL: https://codereview.chromium.org/251143003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267461 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/sync/profile_sync_service.cc103
-rw-r--r--chrome/browser/sync/profile_sync_service.h32
-rw-r--r--components/sync_driver.gypi2
-rw-r--r--components/sync_driver/non_blocking_data_type_controller_unittest.cc2
-rw-r--r--components/sync_driver/non_blocking_data_type_manager.cc78
-rw-r--r--components/sync_driver/non_blocking_data_type_manager.h83
-rw-r--r--sync/internal_api/public/sync_core_proxy.h2
-rw-r--r--sync/internal_api/public/test/null_sync_core_proxy.h2
-rw-r--r--sync/internal_api/sync_core_proxy_impl.cc2
-rw-r--r--sync/internal_api/sync_core_proxy_impl.h2
-rw-r--r--sync/internal_api/test/null_sync_core_proxy.cc2
11 files changed, 257 insertions, 53 deletions
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index cc2b72f..7df9aa7 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -339,24 +339,40 @@ void ProfileSyncService::UnregisterAuthNotifications() {
void ProfileSyncService::RegisterDataTypeController(
DataTypeController* data_type_controller) {
- DCHECK_EQ(data_type_controllers_.count(data_type_controller->type()), 0U);
+ DCHECK_EQ(
+ directory_data_type_controllers_.count(data_type_controller->type()),
+ 0U);
DCHECK(!GetRegisteredNonBlockingDataTypes().Has(
data_type_controller->type()));
- data_type_controllers_[data_type_controller->type()] =
+ directory_data_type_controllers_[data_type_controller->type()] =
data_type_controller;
}
void ProfileSyncService::RegisterNonBlockingType(syncer::ModelType type) {
- DCHECK_EQ(data_type_controllers_.count(type), 0U);
- DCHECK(!GetRegisteredNonBlockingDataTypes().Has(type));
- non_blocking_types_.Put(type);
+ DCHECK_EQ(directory_data_type_controllers_.count(type), 0U)
+ << "Duplicate registration of type " << ModelTypeToString(type);
+
+ // TODO(rlarocque): Set the enable flag properly when crbug.com/368834 is
+ // fixed and we have some way of telling whether or not this type should be
+ // enabled.
+ non_blocking_data_type_manager_.RegisterType(type, false);
+}
+
+void ProfileSyncService::InitializeNonBlockingType(
+ syncer::ModelType type,
+ scoped_refptr<base::SequencedTaskRunner> task_runner,
+ base::WeakPtr<syncer::NonBlockingTypeProcessor> processor) {
+ non_blocking_data_type_manager_.InitializeTypeProcessor(
+ type,
+ task_runner,
+ processor);
}
bool ProfileSyncService::IsSessionsDataTypeControllerRunning() const {
- return data_type_controllers_.find(syncer::SESSIONS) !=
- data_type_controllers_.end() &&
- data_type_controllers_.find(syncer::SESSIONS)->second->state() ==
- DataTypeController::RUNNING;
+ return directory_data_type_controllers_.find(syncer::SESSIONS) !=
+ directory_data_type_controllers_.end() &&
+ (directory_data_type_controllers_.find(syncer::SESSIONS)->
+ second->state() == DataTypeController::RUNNING);
}
browser_sync::OpenTabsUIDelegate* ProfileSyncService::GetOpenTabsUIDelegate() {
@@ -443,7 +459,8 @@ void ProfileSyncService::RemoveObserverForDeviceInfoChange(
void ProfileSyncService::GetDataTypeControllerStates(
browser_sync::DataTypeController::StateMap* state_map) const {
for (browser_sync::DataTypeController::TypeMap::const_iterator iter =
- data_type_controllers_.begin(); iter != data_type_controllers_.end();
+ directory_data_type_controllers_.begin();
+ iter != directory_data_type_controllers_.end();
++iter)
(*state_map)[iter->first] = iter->second.get()->state();
}
@@ -691,6 +708,8 @@ void ProfileSyncService::ShutdownImpl(
if (!backend_)
return;
+ non_blocking_data_type_manager_.DisconnectSyncBackend();
+
// First, we spin down the backend to stop change processing as soon as
// possible.
base::Time shutdown_start_time = base::Time::Now();
@@ -701,14 +720,14 @@ void ProfileSyncService::ShutdownImpl(
// change from a native model. In that case, it will get applied to the sync
// database (which doesn't get destroyed until we destroy the backend below)
// as an unsynced change. That will be persisted, and committed on restart.
- if (data_type_manager_) {
- if (data_type_manager_->state() != DataTypeManager::STOPPED) {
+ if (directory_data_type_manager_) {
+ if (directory_data_type_manager_->state() != DataTypeManager::STOPPED) {
// When aborting as part of shutdown, we should expect an aborted sync
// configure result, else we'll dcheck when we try to read the sync error.
expect_sync_configuration_aborted_ = true;
- data_type_manager_->Stop();
+ directory_data_type_manager_->Stop();
}
- data_type_manager_.reset();
+ directory_data_type_manager_.reset();
}
// Shutdown the migrator before the backend to ensure it doesn't pull a null
@@ -793,7 +812,7 @@ void ProfileSyncService::ClearUnrecoverableError() {
}
void ProfileSyncService::RegisterNewDataType(syncer::ModelType data_type) {
- if (data_type_controllers_.count(data_type) > 0)
+ if (directory_data_type_controllers_.count(data_type) > 0)
return;
NOTREACHED();
}
@@ -913,6 +932,9 @@ void ProfileSyncService::OnBackendInitialized(
backend_->RequestBufferedProtocolEventsAndEnableForwarding();
}
+ non_blocking_data_type_manager_.ConnectSyncBackend(
+ backend_->GetSyncCoreProxy());
+
// If we have a cached passphrase use it to decrypt/encrypt data now that the
// backend is initialized. We want to call this before notifying observers in
// case this operation affects the "passphrase required" status.
@@ -1181,11 +1203,11 @@ void ProfileSyncService::OnPassphraseRequired(
passphrase_required_reason_ = reason;
const syncer::ModelTypeSet types = GetPreferredDirectoryDataTypes();
- if (data_type_manager_) {
+ if (directory_data_type_manager_) {
// Reconfigure without the encrypted types (excluded implicitly via the
// failed datatypes handler).
- data_type_manager_->Configure(types,
- syncer::CONFIGURE_REASON_CRYPTO);
+ directory_data_type_manager_->Configure(types,
+ syncer::CONFIGURE_REASON_CRYPTO);
}
// TODO(rlarocque): Support non-blocking types. http://crbug.com/351005.
@@ -1211,10 +1233,10 @@ void ProfileSyncService::OnPassphraseAccepted() {
// Make sure the data types that depend on the passphrase are started at
// this time.
const syncer::ModelTypeSet types = GetPreferredDirectoryDataTypes();
- if (data_type_manager_) {
+ if (directory_data_type_manager_) {
// Re-enable any encrypted types if necessary.
- data_type_manager_->Configure(types,
- syncer::CONFIGURE_REASON_CRYPTO);
+ directory_data_type_manager_->Configure(types,
+ syncer::CONFIGURE_REASON_CRYPTO);
}
// TODO(rlarocque): Support non-blocking types. http://crbug.com/351005.
@@ -1256,7 +1278,7 @@ void ProfileSyncService::OnEncryptionComplete() {
void ProfileSyncService::OnMigrationNeededForTypes(
syncer::ModelTypeSet types) {
DCHECK(backend_initialized_);
- DCHECK(data_type_manager_.get());
+ DCHECK(directory_data_type_manager_.get());
// Migrator must be valid, because we don't sync until it is created and this
// callback originates from a sync cycle.
@@ -1416,9 +1438,10 @@ ProfileSyncService::SyncStatusSummary
return NOT_ENABLED;
} else if (backend_.get() && !HasSyncSetupCompleted()) {
return SETUP_INCOMPLETE;
- } else if (backend_.get() && HasSyncSetupCompleted() &&
- data_type_manager_.get() &&
- data_type_manager_->state() != DataTypeManager::CONFIGURED) {
+ } else if (
+ backend_.get() && HasSyncSetupCompleted() &&
+ directory_data_type_manager_.get() &&
+ directory_data_type_manager_->state() != DataTypeManager::CONFIGURED) {
return DATATYPES_NOT_INITIALIZED;
} else if (ShouldPushChanges()) {
return INITIALIZED;
@@ -1629,6 +1652,10 @@ void ProfileSyncService::ChangePreferredDataTypes(
// Now reconfigure the DTM.
ReconfigureDatatypeManager();
+
+ // TODO(rlarocque): Reconfigure the NonBlockingDataTypeManager, too. Blocked
+ // on crbug.com/368834. Until that bug is fixed, it's difficult to tell
+ // which types should be enabled and when.
}
syncer::ModelTypeSet ProfileSyncService::GetActiveDataTypes() const {
@@ -1667,11 +1694,11 @@ syncer::ModelTypeSet ProfileSyncService::GetRegisteredDataTypes() const {
syncer::ModelTypeSet
ProfileSyncService::GetRegisteredDirectoryDataTypes() const {
syncer::ModelTypeSet registered_types;
- // The data_type_controllers_ are determined by command-line flags; that's
- // effectively what controls the values returned here.
+ // The directory_data_type_controllers_ are determined by command-line flags;
+ // that's effectively what controls the values returned here.
for (DataTypeController::TypeMap::const_iterator it =
- data_type_controllers_.begin();
- it != data_type_controllers_.end(); ++it) {
+ directory_data_type_controllers_.begin();
+ it != directory_data_type_controllers_.end(); ++it) {
registered_types.Put(it->first);
}
return registered_types;
@@ -1679,7 +1706,7 @@ ProfileSyncService::GetRegisteredDirectoryDataTypes() const {
syncer::ModelTypeSet
ProfileSyncService::GetRegisteredNonBlockingDataTypes() const {
- return non_blocking_types_;
+ return non_blocking_data_type_manager_.GetRegisteredTypes();
}
bool ProfileSyncService::IsUsingSecondaryPassphrase() const {
@@ -1709,7 +1736,7 @@ void ProfileSyncService::ConfigurePriorityDataTypes() {
const syncer::ConfigureReason reason = HasSyncSetupCompleted() ?
syncer::CONFIGURE_REASON_RECONFIGURATION :
syncer::CONFIGURE_REASON_NEW_CLIENT;
- data_type_manager_->Configure(priority_types, reason);
+ directory_data_type_manager_->Configure(priority_types, reason);
}
}
@@ -1723,11 +1750,11 @@ void ProfileSyncService::ConfigureDataTypeManager() {
return;
bool restart = false;
- if (!data_type_manager_) {
+ if (!directory_data_type_manager_) {
restart = true;
- data_type_manager_.reset(
+ directory_data_type_manager_.reset(
factory_->CreateDataTypeManager(debug_info_listener_,
- &data_type_controllers_,
+ &directory_data_type_controllers_,
this,
backend_.get(),
this,
@@ -1737,7 +1764,7 @@ void ProfileSyncService::ConfigureDataTypeManager() {
migrator_.reset(
new browser_sync::BackendMigrator(
profile_->GetDebugName(), GetUserShare(),
- this, data_type_manager_.get(),
+ this, directory_data_type_manager_.get(),
base::Bind(&ProfileSyncService::StartSyncingWithServer,
base::Unretained(this))));
}
@@ -1758,7 +1785,7 @@ void ProfileSyncService::ConfigureDataTypeManager() {
reason = syncer::CONFIGURE_REASON_RECONFIGURATION;
}
- data_type_manager_->Configure(types, reason);
+ directory_data_type_manager_->Configure(types, reason);
}
syncer::UserShare* ProfileSyncService::GetUserShare() const {
@@ -2208,10 +2235,10 @@ bool ProfileSyncService::ShouldPushChanges() {
if (HasUnrecoverableError())
return false;
- if (!data_type_manager_)
+ if (!directory_data_type_manager_)
return false;
- return data_type_manager_->state() == DataTypeManager::CONFIGURED;
+ return directory_data_type_manager_->state() == DataTypeManager::CONFIGURED;
}
void ProfileSyncService::StopAndSuppress() {
diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h
index 737c802..78b510d 100644
--- a/chrome/browser/sync/profile_sync_service.h
+++ b/chrome/browser/sync/profile_sync_service.h
@@ -35,6 +35,7 @@
#include "components/sync_driver/data_type_manager.h"
#include "components/sync_driver/data_type_manager_observer.h"
#include "components/sync_driver/failed_data_types_handler.h"
+#include "components/sync_driver/non_blocking_data_type_manager.h"
#include "components/sync_driver/sync_frontend.h"
#include "components/sync_driver/sync_prefs.h"
#include "google_apis/gaia/google_service_auth_error.h"
@@ -314,6 +315,18 @@ class ProfileSyncService : public ProfileSyncServiceBase,
// the syncing of this type
void RegisterNonBlockingType(syncer::ModelType type);
+ // Called by a component that supports non-blocking sync when it is ready to
+ // initialize its connection to the sync backend.
+ //
+ // If policy allows for syncing this type (ie. it is "preferred"), then this
+ // should result in a message to enable syncing for this type when the sync
+ // backend is available. If the type is not to be synced, this should result
+ // in a message that allows the component to delete its local sync state.
+ void InitializeNonBlockingType(
+ syncer::ModelType type,
+ scoped_refptr<base::SequencedTaskRunner> task_runner,
+ base::WeakPtr<syncer::NonBlockingTypeProcessor> processor);
+
// Return the active OpenTabsUIDelegate. If sessions is not enabled or not
// currently syncing, returns NULL.
virtual browser_sync::OpenTabsUIDelegate* GetOpenTabsUIDelegate();
@@ -742,8 +755,9 @@ class ProfileSyncService : public ProfileSyncServiceBase,
virtual syncer::WeakHandle<syncer::JsEventHandler> GetJsEventHandler();
- const browser_sync::DataTypeController::TypeMap& data_type_controllers() {
- return data_type_controllers_;
+ const browser_sync::DataTypeController::TypeMap&
+ directory_data_type_controllers() {
+ return directory_data_type_controllers_;
}
// Helper method for managing encryption UI.
@@ -904,11 +918,8 @@ class ProfileSyncService : public ProfileSyncServiceBase,
// is equal to !HasSyncSetupCompleted() at the time of OnBackendInitialized().
bool is_first_time_sync_configure_;
- // List of available data type controllers.
- browser_sync::DataTypeController::TypeMap data_type_controllers_;
-
- // List of registered types that use the non-blocking API.
- syncer::ModelTypeSet non_blocking_types_;
+ // List of available data type controllers for directory types.
+ browser_sync::DataTypeController::TypeMap directory_data_type_controllers_;
// Whether the SyncBackendHost has been initialized.
bool backend_initialized_;
@@ -931,8 +942,11 @@ class ProfileSyncService : public ProfileSyncServiceBase,
std::string unrecoverable_error_message_;
tracked_objects::Location unrecoverable_error_location_;
- // Manages the start and stop of the various data types.
- scoped_ptr<browser_sync::DataTypeManager> data_type_manager_;
+ // Manages the start and stop of the directory data types.
+ scoped_ptr<browser_sync::DataTypeManager> directory_data_type_manager_;
+
+ // Manager for the non-blocking data types.
+ browser_sync::NonBlockingDataTypeManager non_blocking_data_type_manager_;
ObserverList<ProfileSyncServiceBase::Observer> observers_;
ObserverList<browser_sync::ProtocolEventObserver> protocol_event_observers_;
diff --git a/components/sync_driver.gypi b/components/sync_driver.gypi
index 0a13f9f..ace2857 100644
--- a/components/sync_driver.gypi
+++ b/components/sync_driver.gypi
@@ -37,6 +37,8 @@
'sync_driver/model_associator.h',
'sync_driver/non_blocking_data_type_controller.cc',
'sync_driver/non_blocking_data_type_controller.h',
+ 'sync_driver/non_blocking_data_type_manager.cc',
+ 'sync_driver/non_blocking_data_type_manager.h',
'sync_driver/pref_names.cc',
'sync_driver/pref_names.h',
'sync_driver/proxy_data_type_controller.cc',
diff --git a/components/sync_driver/non_blocking_data_type_controller_unittest.cc b/components/sync_driver/non_blocking_data_type_controller_unittest.cc
index b695c0b..43c4fa4 100644
--- a/components/sync_driver/non_blocking_data_type_controller_unittest.cc
+++ b/components/sync_driver/non_blocking_data_type_controller_unittest.cc
@@ -27,7 +27,7 @@ class MockSyncCoreProxy : public syncer::SyncCoreProxy {
scoped_refptr<base::SequencedTaskRunner>());
}
- virtual scoped_ptr<SyncCoreProxy> Clone() OVERRIDE {
+ virtual scoped_ptr<SyncCoreProxy> Clone() const OVERRIDE {
return scoped_ptr<SyncCoreProxy>(new MockSyncCoreProxy());
}
};
diff --git a/components/sync_driver/non_blocking_data_type_manager.cc b/components/sync_driver/non_blocking_data_type_manager.cc
new file mode 100644
index 0000000..7ab3497
--- /dev/null
+++ b/components/sync_driver/non_blocking_data_type_manager.cc
@@ -0,0 +1,78 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/sync_driver/non_blocking_data_type_manager.h"
+
+#include "base/sequenced_task_runner.h"
+#include "components/sync_driver/non_blocking_data_type_controller.h"
+#include "sync/internal_api/public/non_blocking_type_processor.h"
+
+namespace browser_sync {
+
+NonBlockingDataTypeManager::NonBlockingDataTypeManager()
+ : non_blocking_data_type_controllers_deleter_(
+ &non_blocking_data_type_controllers_) {}
+
+NonBlockingDataTypeManager::~NonBlockingDataTypeManager() {}
+
+void NonBlockingDataTypeManager::RegisterType(
+ syncer::ModelType type,
+ bool enabled) {
+ DCHECK_EQ(0U, non_blocking_data_type_controllers_.count(type))
+ << "Duplicate registration of type " << ModelTypeToString(type);
+
+ non_blocking_data_type_controllers_.insert(std::make_pair(
+ type,
+ new NonBlockingDataTypeController(
+ type,
+ enabled)));
+}
+
+void NonBlockingDataTypeManager::InitializeTypeProcessor(
+ syncer::ModelType type,
+ const scoped_refptr<base::SequencedTaskRunner>& task_runner,
+ const base::WeakPtr<syncer::NonBlockingTypeProcessor>& processor) {
+ NonBlockingDataTypeControllerMap::iterator it =
+ non_blocking_data_type_controllers_.find(type);
+ DCHECK(it != non_blocking_data_type_controllers_.end());
+ it->second->InitializeProcessor(task_runner, processor);
+}
+
+void NonBlockingDataTypeManager::ConnectSyncBackend(
+ scoped_ptr<syncer::SyncCoreProxy> proxy) {
+ for (NonBlockingDataTypeControllerMap::iterator it =
+ non_blocking_data_type_controllers_.begin();
+ it != non_blocking_data_type_controllers_.end(); ++it) {
+ it->second->InitializeSyncCoreProxy(proxy->Clone());
+ }
+}
+
+void NonBlockingDataTypeManager::DisconnectSyncBackend() {
+ for (NonBlockingDataTypeControllerMap::iterator it =
+ non_blocking_data_type_controllers_.begin();
+ it != non_blocking_data_type_controllers_.end(); ++it) {
+ it->second->ClearSyncCoreProxy();
+ }
+}
+
+void NonBlockingDataTypeManager::SetPreferredTypes(
+ syncer::ModelTypeSet preferred_types) {
+ for (NonBlockingDataTypeControllerMap::iterator it =
+ non_blocking_data_type_controllers_.begin();
+ it != non_blocking_data_type_controllers_.end(); ++it) {
+ it->second->SetIsPreferred(preferred_types.Has(it->first));
+ }
+}
+
+syncer::ModelTypeSet NonBlockingDataTypeManager::GetRegisteredTypes() const {
+ syncer::ModelTypeSet result;
+ for (NonBlockingDataTypeControllerMap::const_iterator it =
+ non_blocking_data_type_controllers_.begin();
+ it != non_blocking_data_type_controllers_.end(); ++it) {
+ result.Put(it->first);
+ }
+ return result;
+}
+
+} // namespace browser_sync
diff --git a/components/sync_driver/non_blocking_data_type_manager.h b/components/sync_driver/non_blocking_data_type_manager.h
new file mode 100644
index 0000000..49e85b3
--- /dev/null
+++ b/components/sync_driver/non_blocking_data_type_manager.h
@@ -0,0 +1,83 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_SYNC_DRIVER_NON_BLOCKING_DATA_TYPE_MANAGER_H_
+#define COMPONENTS_SYNC_DRIVER_NON_BLOCKING_DATA_TYPE_MANAGER_H_
+
+#include <map>
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "base/stl_util.h"
+#include "sync/internal_api/public/base/model_type.h"
+
+namespace base {
+class SequencedTaskRunner;
+} // namespace base
+
+namespace syncer {
+class NonBlockingTypeProcessor;
+class SyncCoreProxy;
+} //namespace syncer
+
+namespace browser_sync {
+
+class NonBlockingDataTypeController;
+
+// Manages a set of NonBlockingDataTypeControllers.
+//
+// Each NonBlockingDataTypeController instance handles the logic around
+// enabling and disabling sync for a particular non-blocking type. This class
+// manages all the controllers.
+class NonBlockingDataTypeManager {
+ public:
+ NonBlockingDataTypeManager();
+ ~NonBlockingDataTypeManager();
+
+ // Declares |type| as a non-blocking type. Should be done early
+ // on during sync initialization.
+ //
+ // The |preferred| flag indicates whether or not this type should be synced.
+ void RegisterType(syncer::ModelType type, bool preferred);
+
+ // Connects the NonBlockingTypeProcessor and associated model type
+ // thread to its NonBlockingDataTypeController on the UI thread.
+ void InitializeTypeProcessor(
+ syncer::ModelType type,
+ const scoped_refptr<base::SequencedTaskRunner>& task_runner,
+ const base::WeakPtr<syncer::NonBlockingTypeProcessor>& processor);
+
+ // Connects the sync backend, as represented by a SyncCoreProxy, to the
+ // NonBlockingDataTypeController on the UI thread.
+ void ConnectSyncBackend(scoped_ptr<syncer::SyncCoreProxy> proxy);
+
+ // Disconnects the sync backend from the UI thread. Should be called
+ // early on during shutdown, but the whole procedure is asynchronous so
+ // there's not much downside to calling it later.
+ void DisconnectSyncBackend();
+
+ // Updates the set of types the user wants to have synced.
+ void SetPreferredTypes(syncer::ModelTypeSet types);
+
+ // Returns the list of all known non-blocking sync types that registered with
+ // RegisterType.
+ syncer::ModelTypeSet GetRegisteredTypes() const;
+
+ private:
+ typedef
+ std::map<syncer::ModelType, browser_sync::NonBlockingDataTypeController*>
+ NonBlockingDataTypeControllerMap;
+
+ // List of data type controllers for non-blocking types.
+ NonBlockingDataTypeControllerMap non_blocking_data_type_controllers_;
+
+ // Deleter for elements of the non-blocking data types controller map.
+ STLValueDeleter<NonBlockingDataTypeControllerMap>
+ non_blocking_data_type_controllers_deleter_;
+};
+
+} // namespace browser_sync
+
+#endif // COMPONENTS_SYNC_DRIVER_NON_BLOCKING_DATA_TYPE_MANAGER_H_
diff --git a/sync/internal_api/public/sync_core_proxy.h b/sync/internal_api/public/sync_core_proxy.h
index 8750b42..5ec8efe 100644
--- a/sync/internal_api/public/sync_core_proxy.h
+++ b/sync/internal_api/public/sync_core_proxy.h
@@ -28,7 +28,7 @@ class SYNC_EXPORT_PRIVATE SyncCoreProxy {
base::WeakPtr<NonBlockingTypeProcessor> type_processor) = 0;
// Creates a clone of this SyncCoreProxy.
- virtual scoped_ptr<SyncCoreProxy> Clone() = 0;
+ virtual scoped_ptr<SyncCoreProxy> Clone() const = 0;
};
} // namespace syncer
diff --git a/sync/internal_api/public/test/null_sync_core_proxy.h b/sync/internal_api/public/test/null_sync_core_proxy.h
index 410a992..a491de9 100644
--- a/sync/internal_api/public/test/null_sync_core_proxy.h
+++ b/sync/internal_api/public/test/null_sync_core_proxy.h
@@ -23,7 +23,7 @@ class NullSyncCoreProxy : public SyncCoreProxy {
virtual void ConnectTypeToCore(
syncer::ModelType type,
base::WeakPtr<NonBlockingTypeProcessor> processor) OVERRIDE;
- virtual scoped_ptr<SyncCoreProxy> Clone() OVERRIDE;
+ virtual scoped_ptr<SyncCoreProxy> Clone() const OVERRIDE;
};
} // namespace syncer
diff --git a/sync/internal_api/sync_core_proxy_impl.cc b/sync/internal_api/sync_core_proxy_impl.cc
index bfdd146..a75041ac 100644
--- a/sync/internal_api/sync_core_proxy_impl.cc
+++ b/sync/internal_api/sync_core_proxy_impl.cc
@@ -32,7 +32,7 @@ void SyncCoreProxyImpl::ConnectTypeToCore(
type_processor));
}
-scoped_ptr<SyncCoreProxy> SyncCoreProxyImpl::Clone() {
+scoped_ptr<SyncCoreProxy> SyncCoreProxyImpl::Clone() const {
return scoped_ptr<SyncCoreProxy>(
new SyncCoreProxyImpl(sync_task_runner_, sync_core_));
}
diff --git a/sync/internal_api/sync_core_proxy_impl.h b/sync/internal_api/sync_core_proxy_impl.h
index 7ccb26a..99e1b8f 100644
--- a/sync/internal_api/sync_core_proxy_impl.h
+++ b/sync/internal_api/sync_core_proxy_impl.h
@@ -40,7 +40,7 @@ class SYNC_EXPORT_PRIVATE SyncCoreProxyImpl : public SyncCoreProxy {
syncer::ModelType type,
base::WeakPtr<NonBlockingTypeProcessor> type_processor) OVERRIDE;
- virtual scoped_ptr<SyncCoreProxy> Clone() OVERRIDE;
+ virtual scoped_ptr<SyncCoreProxy> Clone() const OVERRIDE;
private:
// A SequencedTaskRunner representing the thread where the SyncCore lives.
diff --git a/sync/internal_api/test/null_sync_core_proxy.cc b/sync/internal_api/test/null_sync_core_proxy.cc
index 866e68b..10fc757 100644
--- a/sync/internal_api/test/null_sync_core_proxy.cc
+++ b/sync/internal_api/test/null_sync_core_proxy.cc
@@ -16,7 +16,7 @@ void NullSyncCoreProxy::ConnectTypeToCore(
NOTREACHED() << "NullSyncCoreProxy is not meant to be used";
}
-scoped_ptr<SyncCoreProxy> NullSyncCoreProxy::Clone() {
+scoped_ptr<SyncCoreProxy> NullSyncCoreProxy::Clone() const {
return scoped_ptr<SyncCoreProxy>(new NullSyncCoreProxy());
}