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/message_loop.h" | 7 #include "base/location.h" |
| 8 #include "base/single_thread_task_runner.h" |
8 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/thread_task_runner_handle.h" |
9 #include "base/tracked_objects.h" | 11 #include "base/tracked_objects.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
11 #include "chrome/browser/sync/profile_sync_service.h" | 13 #include "chrome/browser/sync/profile_sync_service.h" |
12 #include "content/public/browser/notification_details.h" | 14 #include "content/public/browser/notification_details.h" |
13 #include "content/public/browser/notification_source.h" | 15 #include "content/public/browser/notification_source.h" |
14 #include "sync/internal_api/public/configure_reason.h" | 16 #include "sync/internal_api/public/configure_reason.h" |
15 #include "sync/internal_api/public/read_transaction.h" | 17 #include "sync/internal_api/public/read_transaction.h" |
16 #include "sync/protocol/sync.pb.h" | 18 #include "sync/protocol/sync.pb.h" |
17 #include "sync/syncable/directory.h" // TODO(tim): Bug 131130. | 19 #include "sync/syncable/directory.h" // TODO(tim): Bug 131130. |
18 | 20 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 } | 110 } |
109 | 111 |
110 void BackendMigrator::OnConfigureDone( | 112 void BackendMigrator::OnConfigureDone( |
111 const sync_driver::DataTypeManager::ConfigureResult& result) { | 113 const sync_driver::DataTypeManager::ConfigureResult& result) { |
112 if (state_ == IDLE) | 114 if (state_ == IDLE) |
113 return; | 115 return; |
114 | 116 |
115 // |manager_|'s methods aren't re-entrant, and we're notified from | 117 // |manager_|'s methods aren't re-entrant, and we're notified from |
116 // them, so post a task to avoid problems. | 118 // them, so post a task to avoid problems. |
117 SDVLOG(1) << "Posting OnConfigureDoneImpl"; | 119 SDVLOG(1) << "Posting OnConfigureDoneImpl"; |
118 base::MessageLoop::current()->PostTask( | 120 base::ThreadTaskRunnerHandle::Get()->PostTask( |
119 FROM_HERE, | 121 FROM_HERE, base::Bind(&BackendMigrator::OnConfigureDoneImpl, |
120 base::Bind(&BackendMigrator::OnConfigureDoneImpl, | 122 weak_ptr_factory_.GetWeakPtr(), result)); |
121 weak_ptr_factory_.GetWeakPtr(), 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 |