| Index: chrome/browser/sync/profile_sync_service.cc
|
| diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
|
| index 65ffb22746ac9563ce0a6744bd3f59a75dc769b2..0a0e63e7d264086fb39a48dadbfe57f10c5b487d 100644
|
| --- a/chrome/browser/sync/profile_sync_service.cc
|
| +++ b/chrome/browser/sync/profile_sync_service.cc
|
| @@ -40,7 +40,7 @@
|
| #include "chrome/browser/sync/internal_api/sync_manager.h"
|
| #include "chrome/browser/sync/js/js_arg_list.h"
|
| #include "chrome/browser/sync/js/js_event_details.h"
|
| -#include "chrome/browser/sync/profile_sync_components_factory.h"
|
| +#include "chrome/browser/sync/profile_sync_components_factory_impl.h"
|
| #include "chrome/browser/sync/sync_global_error.h"
|
| #include "chrome/browser/sync/util/cryptographer.h"
|
| #include "chrome/browser/sync/util/oauth.h"
|
| @@ -140,12 +140,11 @@ ProfileSyncService::ProfileSyncService(ProfileSyncComponentsFactory* factory,
|
| channel == chrome::VersionInfo::CHANNEL_BETA) {
|
| sync_service_url_ = GURL(kSyncServerUrl);
|
| }
|
| -
|
| }
|
|
|
| ProfileSyncService::~ProfileSyncService() {
|
| sync_prefs_.RemoveSyncPrefObserver(this);
|
| - Shutdown(false);
|
| + Shutdown();
|
| }
|
|
|
| bool ProfileSyncService::AreCredentialsAvailable() {
|
| @@ -379,7 +378,11 @@ void ProfileSyncService::StartUp() {
|
| }
|
| }
|
|
|
| -void ProfileSyncService::Shutdown(bool sync_disabled) {
|
| +void ProfileSyncService::Shutdown() {
|
| + ShutdownImpl(false);
|
| +}
|
| +
|
| +void ProfileSyncService::ShutdownImpl(bool sync_disabled) {
|
| // First, we spin down the backend and wait for it to stop syncing completely
|
| // before we Stop the data type manager. This is to avoid a late sync cycle
|
| // applying changes to the sync db that wouldn't get applied via
|
| @@ -462,7 +465,7 @@ void ProfileSyncService::DisableForUser() {
|
| // PSS clients don't think we're set up while we're shutting down.
|
| sync_prefs_.ClearPreferences();
|
| ClearUnrecoverableError();
|
| - Shutdown(true);
|
| + ShutdownImpl(true);
|
|
|
| // TODO(atwilson): Don't call SignOut() on *any* platform - move this into
|
| // the UI layer if needed (sync activity should never result in the user
|
| @@ -524,13 +527,14 @@ void ProfileSyncService::RegisterNewDataType(syncable::ModelType data_type) {
|
| switch (data_type) {
|
| case syncable::SESSIONS:
|
| RegisterDataTypeController(
|
| - new browser_sync::SessionDataTypeController(factory_,
|
| + new browser_sync::SessionDataTypeController(factory_.get(),
|
| profile_,
|
| this));
|
| return;
|
| case syncable::TYPED_URLS:
|
| RegisterDataTypeController(
|
| - new browser_sync::TypedUrlDataTypeController(factory_, profile_));
|
| + new browser_sync::TypedUrlDataTypeController(factory_.get(),
|
| + profile_));
|
| return;
|
| default:
|
| break;
|
| @@ -559,7 +563,7 @@ void ProfileSyncService::OnUnrecoverableError(
|
|
|
| // Shut all data types down.
|
| MessageLoop::current()->PostTask(FROM_HERE,
|
| - base::Bind(&ProfileSyncService::Shutdown, weak_factory_.GetWeakPtr(),
|
| + base::Bind(&ProfileSyncService::ShutdownImpl, weak_factory_.GetWeakPtr(),
|
| true));
|
| }
|
|
|
| @@ -1516,7 +1520,7 @@ bool ProfileSyncService::ShouldPushChanges() {
|
|
|
| void ProfileSyncService::StopAndSuppress() {
|
| sync_prefs_.SetStartSuppressed(true);
|
| - Shutdown(false);
|
| + ShutdownImpl(false);
|
| }
|
|
|
| void ProfileSyncService::UnsuppressAndStart() {
|
|
|