OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <algorithm> | 7 #include <algorithm> |
8 #include <cstddef> | 8 #include <cstddef> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/sync/engine/passive_model_worker.h" |
14 #include "chrome/browser/sync/glue/browser_thread_model_worker.h" | 15 #include "chrome/browser/sync/glue/browser_thread_model_worker.h" |
15 #include "chrome/browser/sync/glue/change_processor.h" | 16 #include "chrome/browser/sync/glue/change_processor.h" |
16 #include "chrome/browser/sync/glue/history_model_worker.h" | 17 #include "chrome/browser/sync/glue/history_model_worker.h" |
17 #include "chrome/browser/sync/glue/password_model_worker.h" | 18 #include "chrome/browser/sync/glue/password_model_worker.h" |
18 #include "chrome/browser/sync/glue/ui_model_worker.h" | 19 #include "chrome/browser/sync/glue/ui_model_worker.h" |
19 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
20 | 21 |
21 using content::BrowserThread; | 22 using content::BrowserThread; |
22 | 23 |
23 namespace browser_sync { | 24 namespace browser_sync { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 profile_(profile), | 59 profile_(profile), |
59 sync_loop_(sync_loop), | 60 sync_loop_(sync_loop), |
60 ui_worker_(new UIModelWorker()), | 61 ui_worker_(new UIModelWorker()), |
61 stopped_on_ui_thread_(false) { | 62 stopped_on_ui_thread_(false) { |
62 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 63 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
63 CHECK(profile_); | 64 CHECK(profile_); |
64 DCHECK(sync_loop_); | 65 DCHECK(sync_loop_); |
65 workers_[GROUP_DB] = new DatabaseModelWorker(); | 66 workers_[GROUP_DB] = new DatabaseModelWorker(); |
66 workers_[GROUP_FILE] = new FileModelWorker(); | 67 workers_[GROUP_FILE] = new FileModelWorker(); |
67 workers_[GROUP_UI] = ui_worker_; | 68 workers_[GROUP_UI] = ui_worker_; |
68 workers_[GROUP_PASSIVE] = new ModelSafeWorker(); | 69 workers_[GROUP_PASSIVE] = new PassiveModelWorker(sync_loop_); |
69 | 70 |
70 // Any datatypes that we want the syncer to pull down must be in the | 71 // Any datatypes that we want the syncer to pull down must be in the |
71 // routing_info map. We set them to group passive, meaning that | 72 // routing_info map. We set them to group passive, meaning that |
72 // updates will be applied to sync, but not dispatched to the native | 73 // updates will be applied to sync, but not dispatched to the native |
73 // models. | 74 // models. |
74 for (syncable::ModelTypeSet::const_iterator it = initial_types.begin(); | 75 for (syncable::ModelTypeSet::const_iterator it = initial_types.begin(); |
75 it != initial_types.end(); ++it) { | 76 it != initial_types.end(); ++it) { |
76 routing_info_[*it] = GROUP_PASSIVE; | 77 routing_info_[*it] = GROUP_PASSIVE; |
77 } | 78 } |
78 | 79 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 return it->second; | 285 return it->second; |
285 } | 286 } |
286 | 287 |
287 bool SyncBackendRegistrar::IsCurrentThreadSafeForModel( | 288 bool SyncBackendRegistrar::IsCurrentThreadSafeForModel( |
288 syncable::ModelType model_type) const { | 289 syncable::ModelType model_type) const { |
289 lock_.AssertAcquired(); | 290 lock_.AssertAcquired(); |
290 return IsOnThreadForGroup(GetGroupForModelType(model_type, routing_info_)); | 291 return IsOnThreadForGroup(GetGroupForModelType(model_type, routing_info_)); |
291 } | 292 } |
292 | 293 |
293 } // namespace browser_sync | 294 } // namespace browser_sync |
OLD | NEW |