Chromium Code Reviews| 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 659c3121edf932ac446fa1edcbf2b0626df3d7de..3eb61f4518833012eaed7d4ee81da7116fce39ad 100644 |
| --- a/chrome/browser/sync/profile_sync_service.cc |
| +++ b/chrome/browser/sync/profile_sync_service.cc |
| @@ -26,7 +26,6 @@ |
| #include "chrome/browser/net/gaia/token_service.h" |
| #include "chrome/browser/prefs/pref_service.h" |
| #include "chrome/browser/profiles/profile.h" |
| -#include "chrome/browser/sync/backend_migrator.h" |
| #include "chrome/browser/sync/glue/change_processor.h" |
| #include "chrome/browser/sync/glue/data_type_controller.h" |
| #include "chrome/browser/sync/glue/session_data_type_controller.h" |
| @@ -392,7 +391,7 @@ void ProfileSyncService::InitializeBackend(bool delete_sync_data_folder) { |
| } |
| void ProfileSyncService::CreateBackend() { |
| - backend_.reset(new SyncBackendHost(profile_)); |
| + backend_.reset(new SyncBackendHost(profile_->GetDebugName(), profile_)); |
| } |
| bool ProfileSyncService::IsEncryptedDatatypeEnabled() const { |
| @@ -448,6 +447,9 @@ void ProfileSyncService::Shutdown(bool sync_disabled) { |
| // Shutdown the migrator before the backend to ensure it doesn't pull a null |
| // snapshot. |
| + if (migrator_.get()) { |
| + migrator_->RemoveMigrationObserver(this); |
|
tim (not reviewing)
2011/09/01 01:50:56
hm, I thought we discussed just having the harness
akalin
2011/09/01 02:19:40
Okay, I guess that requires plumbing the migrator
akalin
2011/09/01 03:39:50
Exposed migrator via GetBackendMigratorForTest().
|
| + } |
| migrator_.reset(); |
| sync_js_controller_.AttachJsBackend(WeakHandle<JsBackend>()); |
| @@ -604,11 +606,11 @@ void ProfileSyncService::OnUnrecoverableError( |
| wizard_.Step(SyncSetupWizard::FATAL_ERROR); |
| NotifyObservers(); |
| - LOG(ERROR) << "Unrecoverable error detected -- ProfileSyncService unusable." |
| - << message; |
| std::string location; |
| from_here.Write(true, true, &location); |
| - LOG(ERROR) << location; |
| + LOG(ERROR) |
| + << "Unrecoverable error detected at " << location |
| + << " -- ProfileSyncService unusable: " << message; |
| // Shut all data types down. |
| MessageLoop::current()->PostTask(FROM_HERE, |
| @@ -616,6 +618,11 @@ void ProfileSyncService::OnUnrecoverableError( |
| &ProfileSyncService::Shutdown, true)); |
| } |
| +void ProfileSyncService::OnMigrationStateChange() { |
| + // Needed by migration integration tests. |
| + NotifyObservers(); |
| +} |
| + |
| void ProfileSyncService::OnBackendInitialized( |
| const WeakHandle<JsBackend>& js_backend, bool success) { |
| if (!success) { |
| @@ -1227,7 +1234,10 @@ void ProfileSyncService::ConfigureDataTypeManager() { |
| // We create the migrator at the same time. |
| migrator_.reset( |
| - new browser_sync::BackendMigrator(this, data_type_manager_.get())); |
| + new browser_sync::BackendMigrator( |
| + profile_->GetDebugName(), GetUserShare(), |
| + this, data_type_manager_.get())); |
| + migrator_->AddMigrationObserver(this); |
| } |
| syncable::ModelTypeSet types; |
| @@ -1301,6 +1311,14 @@ bool ProfileSyncService::HasPendingBackendMigration() const { |
| migrator_->state() != browser_sync::BackendMigrator::IDLE; |
| } |
| +syncable::ModelTypeSet |
| + ProfileSyncService::GetPendingMigrationTypesForTest() const { |
| + return |
| + migrator_.get() ? |
| + migrator_->GetPendingMigrationTypesForTest() : |
| + syncable::ModelTypeSet(); |
| +} |
| + |
| void ProfileSyncService::GetModelSafeRoutingInfo( |
| browser_sync::ModelSafeRoutingInfo* out) const { |
| if (backend_.get() && backend_initialized_) { |