Index: chrome/browser/sync/sync_setup_wizard.cc |
=================================================================== |
--- chrome/browser/sync/sync_setup_wizard.cc (revision 74394) |
+++ chrome/browser/sync/sync_setup_wizard.cc (working copy) |
@@ -260,19 +260,14 @@ |
: service_(service), |
flow_container_(new SyncSetupFlowContainer()), |
parent_window_(NULL) { |
- // If we're in a unit test, we may not have an IO thread. Avoid |
+ // If we're in a unit test, we may not have an IO thread or profile. Avoid |
// creating a SyncResourcesSource since we may leak it (since it's |
// DeleteOnUIThread). |
- if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) { |
+ if (BrowserThread::IsMessageLoopValid(BrowserThread::IO) && |
+ service_->profile()) { |
// Add our network layer data source for 'cloudy' URLs. |
SyncResourcesSource* sync_source = new SyncResourcesSource(); |
- bool posted = |
- BrowserThread::PostTask( |
- BrowserThread::IO, FROM_HERE, |
- NewRunnableMethod(ChromeURLDataManager::GetInstance(), |
- &ChromeURLDataManager::AddDataSource, |
- make_scoped_refptr(sync_source))); |
- DCHECK(posted); |
+ service_->profile()->GetChromeURLDataManager()->AddDataSource(sync_source); |
} |
} |