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/glue/sync_backend_registrar.h" | 5 #include "chrome/browser/sync/glue/sync_backend_registrar.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 case syncer::MODEL_SAFE_GROUP_COUNT: | 48 case syncer::MODEL_SAFE_GROUP_COUNT: |
49 default: | 49 default: |
50 return false; | 50 return false; |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 } // namespace | 54 } // namespace |
55 | 55 |
56 SyncBackendRegistrar::SyncBackendRegistrar( | 56 SyncBackendRegistrar::SyncBackendRegistrar( |
57 const std::string& name, Profile* profile, | 57 const std::string& name, Profile* profile, |
58 MessageLoop* sync_loop) : | 58 base::MessageLoop* sync_loop) : |
59 name_(name), | 59 name_(name), |
60 profile_(profile), | 60 profile_(profile), |
61 sync_loop_(sync_loop), | 61 sync_loop_(sync_loop), |
62 ui_worker_(new UIModelWorker()), | 62 ui_worker_(new UIModelWorker()), |
63 stopped_on_ui_thread_(false) { | 63 stopped_on_ui_thread_(false) { |
64 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 64 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
65 CHECK(profile_); | 65 CHECK(profile_); |
66 DCHECK(sync_loop_); | 66 DCHECK(sync_loop_); |
67 workers_[syncer::GROUP_DB] = new DatabaseModelWorker(); | 67 workers_[syncer::GROUP_DB] = new DatabaseModelWorker(); |
68 workers_[syncer::GROUP_FILE] = new FileModelWorker(); | 68 workers_[syncer::GROUP_FILE] = new FileModelWorker(); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 168 } |
169 | 169 |
170 void SyncBackendRegistrar::StopOnUIThread() { | 170 void SyncBackendRegistrar::StopOnUIThread() { |
171 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 171 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
172 DCHECK(!stopped_on_ui_thread_); | 172 DCHECK(!stopped_on_ui_thread_); |
173 ui_worker_->Stop(); | 173 ui_worker_->Stop(); |
174 stopped_on_ui_thread_ = true; | 174 stopped_on_ui_thread_ = true; |
175 } | 175 } |
176 | 176 |
177 void SyncBackendRegistrar::OnSyncerShutdownComplete() { | 177 void SyncBackendRegistrar::OnSyncerShutdownComplete() { |
178 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 178 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); |
179 ui_worker_->OnSyncerShutdownComplete(); | 179 ui_worker_->OnSyncerShutdownComplete(); |
180 } | 180 } |
181 | 181 |
182 void SyncBackendRegistrar::ActivateDataType( | 182 void SyncBackendRegistrar::ActivateDataType( |
183 syncer::ModelType type, | 183 syncer::ModelType type, |
184 syncer::ModelSafeGroup group, | 184 syncer::ModelSafeGroup group, |
185 ChangeProcessor* change_processor, | 185 ChangeProcessor* change_processor, |
186 syncer::UserShare* user_share) { | 186 syncer::UserShare* user_share) { |
187 CHECK(IsOnThreadForGroup(type, group)); | 187 CHECK(IsOnThreadForGroup(type, group)); |
188 base::AutoLock lock(lock_); | 188 base::AutoLock lock(lock_); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 } | 289 } |
290 | 290 |
291 bool SyncBackendRegistrar::IsCurrentThreadSafeForModel( | 291 bool SyncBackendRegistrar::IsCurrentThreadSafeForModel( |
292 syncer::ModelType model_type) const { | 292 syncer::ModelType model_type) const { |
293 lock_.AssertAcquired(); | 293 lock_.AssertAcquired(); |
294 return IsOnThreadForGroup(model_type, | 294 return IsOnThreadForGroup(model_type, |
295 GetGroupForModelType(model_type, routing_info_)); | 295 GetGroupForModelType(model_type, routing_info_)); |
296 } | 296 } |
297 | 297 |
298 } // namespace browser_sync | 298 } // namespace browser_sync |
OLD | NEW |