| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "sync/internal_api/sync_context.h" |
| 6 |
| 7 #include "sync/engine/model_type_sync_worker_impl.h" |
| 8 #include "sync/sessions/model_type_registry.h" |
| 9 |
| 10 namespace syncer { |
| 11 |
| 12 SyncContext::SyncContext(ModelTypeRegistry* model_type_registry) |
| 13 : model_type_registry_(model_type_registry), weak_ptr_factory_(this) { |
| 14 } |
| 15 |
| 16 SyncContext::~SyncContext() { |
| 17 } |
| 18 |
| 19 void SyncContext::ConnectSyncTypeToWorker( |
| 20 ModelType type, |
| 21 const DataTypeState& data_type_state, |
| 22 scoped_refptr<base::SequencedTaskRunner> task_runner, |
| 23 base::WeakPtr<ModelTypeSyncProxyImpl> type_sync_proxy) { |
| 24 // Initialize the type sync proxy's sync-thread sibling and the |
| 25 // ModelTypeSyncProxy <-> ModelTypeSyncWorker |
| 26 // (ie. model thread <-> sync thread) communication channel. |
| 27 model_type_registry_->InitializeNonBlockingType( |
| 28 type, data_type_state, task_runner, type_sync_proxy); |
| 29 } |
| 30 |
| 31 void SyncContext::Disconnect(ModelType type) { |
| 32 model_type_registry_->RemoveNonBlockingType(type); |
| 33 } |
| 34 |
| 35 base::WeakPtr<SyncContext> SyncContext::AsWeakPtr() { |
| 36 return weak_ptr_factory_.GetWeakPtr(); |
| 37 } |
| 38 |
| 39 } // namespace syncer |
| OLD | NEW |