| 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 "chrome/browser/sync/backend_migrator.h" | 5 #include "chrome/browser/sync/backend_migrator.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/tracked_objects.h" | 9 #include "base/tracked_objects.h" |
| 10 #include "chrome/browser/sync/profile_sync_service.h" | 10 #include "chrome/browser/sync/profile_sync_service.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 } | 108 } |
| 109 | 109 |
| 110 void BackendMigrator::OnConfigureDone( | 110 void BackendMigrator::OnConfigureDone( |
| 111 const DataTypeManager::ConfigureResult& result) { | 111 const DataTypeManager::ConfigureResult& result) { |
| 112 if (state_ == IDLE) | 112 if (state_ == IDLE) |
| 113 return; | 113 return; |
| 114 | 114 |
| 115 // |manager_|'s methods aren't re-entrant, and we're notified from | 115 // |manager_|'s methods aren't re-entrant, and we're notified from |
| 116 // them, so post a task to avoid problems. | 116 // them, so post a task to avoid problems. |
| 117 SDVLOG(1) << "Posting OnConfigureDoneImpl"; | 117 SDVLOG(1) << "Posting OnConfigureDoneImpl"; |
| 118 MessageLoop::current()->PostTask( | 118 base::MessageLoop::current()->PostTask( |
| 119 FROM_HERE, | 119 FROM_HERE, |
| 120 base::Bind(&BackendMigrator::OnConfigureDoneImpl, | 120 base::Bind(&BackendMigrator::OnConfigureDoneImpl, |
| 121 weak_ptr_factory_.GetWeakPtr(), result)); | 121 weak_ptr_factory_.GetWeakPtr(), |
| 122 result)); |
| 122 } | 123 } |
| 123 | 124 |
| 124 namespace { | 125 namespace { |
| 125 | 126 |
| 126 syncer::ModelTypeSet GetUnsyncedDataTypes(syncer::UserShare* user_share) { | 127 syncer::ModelTypeSet GetUnsyncedDataTypes(syncer::UserShare* user_share) { |
| 127 syncer::ReadTransaction trans(FROM_HERE, user_share); | 128 syncer::ReadTransaction trans(FROM_HERE, user_share); |
| 128 syncer::ModelTypeSet unsynced_data_types; | 129 syncer::ModelTypeSet unsynced_data_types; |
| 129 for (int i = syncer::FIRST_REAL_MODEL_TYPE; | 130 for (int i = syncer::FIRST_REAL_MODEL_TYPE; |
| 130 i < syncer::MODEL_TYPE_COUNT; ++i) { | 131 i < syncer::MODEL_TYPE_COUNT; ++i) { |
| 131 syncer::ModelType type = syncer::ModelTypeFromInt(i); | 132 syncer::ModelType type = syncer::ModelTypeFromInt(i); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 217 |
| 217 syncer::ModelTypeSet BackendMigrator::GetPendingMigrationTypesForTest() const { | 218 syncer::ModelTypeSet BackendMigrator::GetPendingMigrationTypesForTest() const { |
| 218 return to_migrate_; | 219 return to_migrate_; |
| 219 } | 220 } |
| 220 | 221 |
| 221 #undef SDVLOG | 222 #undef SDVLOG |
| 222 | 223 |
| 223 #undef SLOG | 224 #undef SLOG |
| 224 | 225 |
| 225 }; // namespace browser_sync | 226 }; // namespace browser_sync |
| OLD | NEW |