| Index: chrome/browser/sync/glue/sync_backend_registrar.cc
|
| diff --git a/chrome/browser/sync/glue/sync_backend_registrar.cc b/chrome/browser/sync/glue/sync_backend_registrar.cc
|
| index 4cd91b7adb93ac4b2a099866325c7c9a98c39c48..279a4485fc3847e5736be7202e9374b3145ca577 100644
|
| --- a/chrome/browser/sync/glue/sync_backend_registrar.cc
|
| +++ b/chrome/browser/sync/glue/sync_backend_registrar.cc
|
| @@ -29,10 +29,10 @@ namespace {
|
|
|
| // Returns true if the current thread is the native thread for the
|
| // given group (or if it is undeterminable).
|
| -bool IsOnThreadForGroup(syncer::ModelSafeGroup group) {
|
| +bool IsOnThreadForGroup(syncer::ModelType type, syncer::ModelSafeGroup group) {
|
| switch (group) {
|
| case syncer::GROUP_PASSIVE:
|
| - return false;
|
| + return IsControlType(type);
|
| case syncer::GROUP_UI:
|
| return BrowserThread::CurrentlyOn(BrowserThread::UI);
|
| case syncer::GROUP_DB:
|
| @@ -40,11 +40,11 @@ bool IsOnThreadForGroup(syncer::ModelSafeGroup group) {
|
| case syncer::GROUP_FILE:
|
| return BrowserThread::CurrentlyOn(BrowserThread::FILE);
|
| case syncer::GROUP_HISTORY:
|
| - // TODO(ncarter): How to determine this?
|
| - return true;
|
| + // TODO(sync): How to check we're on the right thread?
|
| + return type == syncer::TYPED_URLS;
|
| case syncer::GROUP_PASSWORD:
|
| - // TODO(ncarter): How to determine this?
|
| - return true;
|
| + // TODO(sync): How to check we're on the right thread?
|
| + return type == syncer::PASSWORDS;
|
| case syncer::MODEL_SAFE_GROUP_COUNT:
|
| default:
|
| return false;
|
| @@ -184,7 +184,7 @@ void SyncBackendRegistrar::ActivateDataType(
|
| syncer::ModelSafeGroup group,
|
| ChangeProcessor* change_processor,
|
| syncer::UserShare* user_share) {
|
| - CHECK(IsOnThreadForGroup(group));
|
| + CHECK(IsOnThreadForGroup(type, group));
|
| base::AutoLock lock(lock_);
|
| // Ensure that the given data type is in the PASSIVE group.
|
| syncer::ModelSafeRoutingInfo::iterator i = routing_info_.find(type);
|
| @@ -204,7 +204,7 @@ void SyncBackendRegistrar::ActivateDataType(
|
| }
|
|
|
| void SyncBackendRegistrar::DeactivateDataType(syncer::ModelType type) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || IsControlType(type));
|
| base::AutoLock lock(lock_);
|
| ChangeProcessor* change_processor = GetProcessorUnsafe(type);
|
| if (change_processor)
|
| @@ -294,7 +294,8 @@ ChangeProcessor* SyncBackendRegistrar::GetProcessorUnsafe(
|
| bool SyncBackendRegistrar::IsCurrentThreadSafeForModel(
|
| syncer::ModelType model_type) const {
|
| lock_.AssertAcquired();
|
| - return IsOnThreadForGroup(GetGroupForModelType(model_type, routing_info_));
|
| + return IsOnThreadForGroup(model_type,
|
| + GetGroupForModelType(model_type, routing_info_));
|
| }
|
|
|
| } // namespace browser_sync
|
|
|