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

Unified Diff: chrome/browser/sync/glue/sync_backend_registrar.cc

Issue 10911073: NOT FOR COMMIT: Add DeviceInfo type and ChangeProcessor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix several issues Created 8 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
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
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host_unittest.cc ('k') | chrome/browser/sync/glue/synced_device_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698