| 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 4480774cb8b4e869c4cda223fe9ed6f8d6043f04..48a0b8bf703347af6d7e39e5399599d789aefcf0 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/engine/configure_reason.h"
|
| #include "chrome/browser/sync/glue/change_processor.h"
|
| #include "chrome/browser/sync/glue/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);
|
| + }
|
| 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(),
|
| + 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_) {
|
|
|