diff options
author | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-13 18:47:15 +0000 |
---|---|---|
committer | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-13 18:47:15 +0000 |
commit | 3801e985d672573326e8ab1de6c8f19bbf003494 (patch) | |
tree | 950b040750d45de7e11a1e670d89d6a64753d2bd /chrome/browser/sync | |
parent | 7263dbd86fec864bb9604971aceeeee6b4b32816 (diff) | |
download | chromium_src-3801e985d672573326e8ab1de6c8f19bbf003494.zip chromium_src-3801e985d672573326e8ab1de6c8f19bbf003494.tar.gz chromium_src-3801e985d672573326e8ab1de6c8f19bbf003494.tar.bz2 |
sync: avoid creating a HistoryModelWorker unless it is needed.
We typically add all known workers when Initializing the SyncBackendHost,
but this one is causing crashes and isn't used by default.
BUG=53916,69561
TEST=none
Review URL: http://codereview.chromium.org/6111012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71337 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync')
-rw-r--r-- | chrome/browser/sync/glue/sync_backend_host.cc | 12 | ||||
-rw-r--r-- | chrome/browser/sync/profile_sync_service_password_unittest.cc | 7 | ||||
-rw-r--r-- | chrome/browser/sync/test_profile_sync_service.h | 3 |
3 files changed, 12 insertions, 10 deletions
diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc index 4dafe24..ed363fc 100644 --- a/chrome/browser/sync/glue/sync_backend_host.cc +++ b/chrome/browser/sync/glue/sync_backend_host.cc @@ -97,12 +97,18 @@ void SyncBackendHost::Initialize( // when a new type is synced as the worker may already exist and you just // need to update routing_info_. registrar_.workers[GROUP_DB] = new DatabaseModelWorker(); - registrar_.workers[GROUP_HISTORY] = - new HistoryModelWorker( - profile_->GetHistoryService(Profile::IMPLICIT_ACCESS)); registrar_.workers[GROUP_UI] = new UIModelWorker(frontend_loop_); registrar_.workers[GROUP_PASSIVE] = new ModelSafeWorker(); + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableSyncTypedUrls) || types.count(syncable::TYPED_URLS)) { + // TODO(tim): Bug 53916. HistoryModelWorker crashes, so avoid adding it + // unless specifically requested until bug is fixed. + registrar_.workers[GROUP_HISTORY] = + new HistoryModelWorker( + profile_->GetHistoryService(Profile::IMPLICIT_ACCESS)); + } + PasswordStore* password_store = profile_->GetPasswordStore(Profile::IMPLICIT_ACCESS); if (password_store) { diff --git a/chrome/browser/sync/profile_sync_service_password_unittest.cc b/chrome/browser/sync/profile_sync_service_password_unittest.cc index dfb172b..899b40c 100644 --- a/chrome/browser/sync/profile_sync_service_password_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_password_unittest.cc @@ -166,13 +166,6 @@ class ProfileSyncServicePasswordTest : public AbstractProfileSyncServiceTest { EXPECT_CALL(profile_, GetTokenService()). WillRepeatedly(Return(&token_service_)); - // Creating model safe workers will request the history service and - // password store. I couldn't manage to convince gmock that splitting up - // the expectations to match the class responsibilities was a good thing, - // so we set them all together here. - EXPECT_CALL(profile_, GetHistoryService(_)). - WillOnce(Return(static_cast<HistoryService*>(NULL))); - EXPECT_CALL(profile_, GetPasswordStore(_)). Times(2). WillRepeatedly(Return(password_store_.get())); diff --git a/chrome/browser/sync/test_profile_sync_service.h b/chrome/browser/sync/test_profile_sync_service.h index 2615b24..ae2a331 100644 --- a/chrome/browser/sync/test_profile_sync_service.h +++ b/chrome/browser/sync/test_profile_sync_service.h @@ -173,6 +173,9 @@ class SyncBackendHostForProfileSyncTest : public SyncBackendHost { static void SetDefaultExpectationsForWorkerCreation(ProfileMock* profile) { EXPECT_CALL(*profile, GetPasswordStore(testing::_)). WillOnce(testing::Return((PasswordStore*)NULL)); + } + + static void SetHistoryServiceExpectations(ProfileMock* profile) { EXPECT_CALL(*profile, GetHistoryService(testing::_)). WillOnce(testing::Return((HistoryService*)NULL)); } |