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 342a3d48f7c66fbb2bf8f2ad5ee9ef0bb447014d..e545f1b52c6b4dc0e1d8de5beac8507c3a173da6 100644 |
--- a/chrome/browser/sync/glue/sync_backend_registrar.cc |
+++ b/chrome/browser/sync/glue/sync_backend_registrar.cc |
@@ -54,7 +54,6 @@ bool IsOnThreadForGroup(syncer::ModelSafeGroup group) { |
} // namespace |
SyncBackendRegistrar::SyncBackendRegistrar( |
- syncer::ModelTypeSet initial_types, |
const std::string& name, Profile* profile, |
MessageLoop* sync_loop) : |
name_(name), |
@@ -70,36 +69,42 @@ SyncBackendRegistrar::SyncBackendRegistrar( |
workers_[syncer::GROUP_UI] = ui_worker_; |
workers_[syncer::GROUP_PASSIVE] = new syncer::PassiveModelWorker(sync_loop_); |
- // Any datatypes that we want the syncer to pull down must be in the |
- // routing_info map. We set them to group passive, meaning that |
- // updates will be applied to sync, but not dispatched to the native |
- // models. |
- for (syncer::ModelTypeSet::Iterator it = initial_types.First(); |
- it.Good(); it.Inc()) { |
- routing_info_[it.Get()] = syncer::GROUP_PASSIVE; |
- } |
- |
HistoryService* history_service = |
HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); |
if (history_service) { |
workers_[syncer::GROUP_HISTORY] = new HistoryModelWorker(history_service); |
- } else { |
- LOG_IF(WARNING, initial_types.Has(syncer::TYPED_URLS)) |
- << "History store disabled, cannot sync Omnibox History"; |
- routing_info_.erase(syncer::TYPED_URLS); |
} |
scoped_refptr<PasswordStore> password_store = |
PasswordStoreFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); |
if (password_store.get()) { |
workers_[syncer::GROUP_PASSWORD] = new PasswordModelWorker(password_store); |
- } else { |
+ } |
+} |
+ |
+void SyncBackendRegistrar::SetInitialTypes(syncer::ModelTypeSet initial_types) { |
Nicolas Zea
2012/07/20 21:35:39
add UI thread dcheck. Also probably good to add a
rlarocque
2012/07/20 23:20:05
Done. Also added a ScopedLock for extra safety.
|
+ // Set our initial state to reflect the current status of the sync directory. |
+ // This will ensure that our calculations in ConfigureDataTypes() will always |
+ // return correct results. |
+ for (syncer::ModelTypeSet::Iterator it = initial_types.First(); |
+ it.Good(); it.Inc()) { |
+ routing_info_[it.Get()] = syncer::GROUP_PASSIVE; |
+ } |
+ |
+ if (!workers_.count(syncer::GROUP_HISTORY)) { |
+ LOG_IF(WARNING, initial_types.Has(syncer::TYPED_URLS)) |
+ << "History store disabled, cannot sync Omnibox History"; |
+ routing_info_.erase(syncer::TYPED_URLS); |
+ } |
+ |
+ if (!workers_.count(syncer::GROUP_PASSWORD)) { |
LOG_IF(WARNING, initial_types.Has(syncer::PASSWORDS)) |
<< "Password store not initialized, cannot sync passwords"; |
routing_info_.erase(syncer::PASSWORDS); |
} |
} |
+ |
Nicolas Zea
2012/07/20 21:35:39
remove newline
rlarocque
2012/07/23 20:50:30
Done.
|
SyncBackendRegistrar::~SyncBackendRegistrar() { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
DCHECK(stopped_on_ui_thread_); |