| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "components/sync/driver/backend_migrator.h" | 5 #include "components/sync/driver/backend_migrator.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 const MigrationObserver* observer) const { | 74 const MigrationObserver* observer) const { |
| 75 return migration_observers_.HasObserver(observer); | 75 return migration_observers_.HasObserver(observer); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void BackendMigrator::RemoveMigrationObserver(MigrationObserver* observer) { | 78 void BackendMigrator::RemoveMigrationObserver(MigrationObserver* observer) { |
| 79 migration_observers_.RemoveObserver(observer); | 79 migration_observers_.RemoveObserver(observer); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void BackendMigrator::ChangeState(State new_state) { | 82 void BackendMigrator::ChangeState(State new_state) { |
| 83 state_ = new_state; | 83 state_ = new_state; |
| 84 FOR_EACH_OBSERVER(MigrationObserver, migration_observers_, | 84 for (auto& observer : migration_observers_) |
| 85 OnMigrationStateChange()); | 85 observer.OnMigrationStateChange(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 bool BackendMigrator::TryStart() { | 88 bool BackendMigrator::TryStart() { |
| 89 DCHECK_EQ(state_, WAITING_TO_START); | 89 DCHECK_EQ(state_, WAITING_TO_START); |
| 90 if (manager_->state() == DataTypeManager::CONFIGURED) { | 90 if (manager_->state() == DataTypeManager::CONFIGURED) { |
| 91 RestartMigration(); | 91 RestartMigration(); |
| 92 return true; | 92 return true; |
| 93 } | 93 } |
| 94 return false; | 94 return false; |
| 95 } | 95 } |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 209 |
| 210 ModelTypeSet BackendMigrator::GetPendingMigrationTypesForTest() const { | 210 ModelTypeSet BackendMigrator::GetPendingMigrationTypesForTest() const { |
| 211 return to_migrate_; | 211 return to_migrate_; |
| 212 } | 212 } |
| 213 | 213 |
| 214 #undef SDVLOG | 214 #undef SDVLOG |
| 215 | 215 |
| 216 #undef SLOG | 216 #undef SLOG |
| 217 | 217 |
| 218 }; // namespace syncer | 218 }; // namespace syncer |
| OLD | NEW |