| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/sync/test/integration/migration_watcher.h" | 5 #include "chrome/browser/sync/test/integration/migration_watcher.h" |
| 6 | 6 |
| 7 #include "chrome/browser/sync/test/integration/migration_waiter.h" | 7 #include "chrome/browser/sync/test/integration/migration_waiter.h" |
| 8 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" | 8 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" |
| 9 #include "components/browser_sync/profile_sync_service.h" | 9 #include "components/browser_sync/profile_sync_service.h" |
| 10 | 10 |
| 11 MigrationWatcher::MigrationWatcher(ProfileSyncServiceHarness* harness) | 11 MigrationWatcher::MigrationWatcher(ProfileSyncServiceHarness* harness) |
| 12 : harness_(harness), migration_waiter_(NULL) { | 12 : harness_(harness), migration_waiter_(NULL) { |
| 13 browser_sync::BackendMigrator* migrator = | 13 syncer::BackendMigrator* migrator = |
| 14 harness_->service()->GetBackendMigratorForTest(); | 14 harness_->service()->GetBackendMigratorForTest(); |
| 15 // PSS must have a migrator after sync is setup and initial data type | 15 // PSS must have a migrator after sync is setup and initial data type |
| 16 // configuration is complete. | 16 // configuration is complete. |
| 17 migrator->AddMigrationObserver(this); | 17 migrator->AddMigrationObserver(this); |
| 18 } | 18 } |
| 19 | 19 |
| 20 MigrationWatcher::~MigrationWatcher() { | 20 MigrationWatcher::~MigrationWatcher() { |
| 21 DCHECK(!migration_waiter_); | 21 DCHECK(!migration_waiter_); |
| 22 } | 22 } |
| 23 | 23 |
| 24 bool MigrationWatcher::HasPendingBackendMigration() const { | 24 bool MigrationWatcher::HasPendingBackendMigration() const { |
| 25 browser_sync::BackendMigrator* migrator = | 25 syncer::BackendMigrator* migrator = |
| 26 harness_->service()->GetBackendMigratorForTest(); | 26 harness_->service()->GetBackendMigratorForTest(); |
| 27 return migrator && migrator->state() != browser_sync::BackendMigrator::IDLE; | 27 return migrator && migrator->state() != syncer::BackendMigrator::IDLE; |
| 28 } | 28 } |
| 29 | 29 |
| 30 syncer::ModelTypeSet MigrationWatcher::GetMigratedTypes() const { | 30 syncer::ModelTypeSet MigrationWatcher::GetMigratedTypes() const { |
| 31 return migrated_types_; | 31 return migrated_types_; |
| 32 } | 32 } |
| 33 | 33 |
| 34 void MigrationWatcher::OnMigrationStateChange() { | 34 void MigrationWatcher::OnMigrationStateChange() { |
| 35 if (HasPendingBackendMigration()) { | 35 if (HasPendingBackendMigration()) { |
| 36 // A new bunch of data types are in the process of being migrated. Merge | 36 // A new bunch of data types are in the process of being migrated. Merge |
| 37 // them into |pending_types_|. | 37 // them into |pending_types_|. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 57 | 57 |
| 58 void MigrationWatcher::set_migration_waiter(MigrationWaiter* waiter) { | 58 void MigrationWatcher::set_migration_waiter(MigrationWaiter* waiter) { |
| 59 DCHECK(!migration_waiter_); | 59 DCHECK(!migration_waiter_); |
| 60 migration_waiter_ = waiter; | 60 migration_waiter_ = waiter; |
| 61 } | 61 } |
| 62 | 62 |
| 63 void MigrationWatcher::clear_migration_waiter() { | 63 void MigrationWatcher::clear_migration_waiter() { |
| 64 DCHECK(migration_waiter_); | 64 DCHECK(migration_waiter_); |
| 65 migration_waiter_ = NULL; | 65 migration_waiter_ = NULL; |
| 66 } | 66 } |
| OLD | NEW |