| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/engine/sync_backend_registrar.h" | 5 #include "components/sync/engine/sync_backend_registrar.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 lock_.AssertAcquired(); | 257 lock_.AssertAcquired(); |
| 258 ModelSafeGroup group = GetGroupForModelType(model_type, routing_info_); | 258 ModelSafeGroup group = GetGroupForModelType(model_type, routing_info_); |
| 259 DCHECK_NE(GROUP_NON_BLOCKING, group); | 259 DCHECK_NE(GROUP_NON_BLOCKING, group); |
| 260 | 260 |
| 261 if (group == GROUP_PASSIVE) { | 261 if (group == GROUP_PASSIVE) { |
| 262 return IsControlType(model_type); | 262 return IsControlType(model_type); |
| 263 } | 263 } |
| 264 | 264 |
| 265 auto it = workers_.find(group); | 265 auto it = workers_.find(group); |
| 266 DCHECK(it != workers_.end()); | 266 DCHECK(it != workers_.end()); |
| 267 return it->second->IsOnModelThread(); | 267 return it->second->IsOnModelSequence(); |
| 268 } | 268 } |
| 269 | 269 |
| 270 SyncBackendRegistrar::~SyncBackendRegistrar() { | 270 SyncBackendRegistrar::~SyncBackendRegistrar() { |
| 271 // All data types should have been deactivated by now. | 271 // All data types should have been deactivated by now. |
| 272 DCHECK(processors_.empty()); | 272 DCHECK(processors_.empty()); |
| 273 } | 273 } |
| 274 | 274 |
| 275 void SyncBackendRegistrar::MaybeAddWorker(ModelSafeWorkerFactory worker_factory, | 275 void SyncBackendRegistrar::MaybeAddWorker(ModelSafeWorkerFactory worker_factory, |
| 276 ModelSafeGroup group) { | 276 ModelSafeGroup group) { |
| 277 scoped_refptr<ModelSafeWorker> worker = worker_factory.Run(group); | 277 scoped_refptr<ModelSafeWorker> worker = worker_factory.Run(group); |
| 278 if (worker) { | 278 if (worker) { |
| 279 DCHECK(workers_.find(group) == workers_.end()); | 279 DCHECK(workers_.find(group) == workers_.end()); |
| 280 workers_[group] = worker; | 280 workers_[group] = worker; |
| 281 } | 281 } |
| 282 } | 282 } |
| 283 | 283 |
| 284 ModelSafeGroup SyncBackendRegistrar::GetInitialGroupForType( | 284 ModelSafeGroup SyncBackendRegistrar::GetInitialGroupForType( |
| 285 ModelType type) const { | 285 ModelType type) const { |
| 286 return non_blocking_types_.Has(type) ? GROUP_NON_BLOCKING : GROUP_PASSIVE; | 286 return non_blocking_types_.Has(type) ? GROUP_NON_BLOCKING : GROUP_PASSIVE; |
| 287 } | 287 } |
| 288 | 288 |
| 289 } // namespace syncer | 289 } // namespace syncer |
| OLD | NEW |