| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "sync/internal_api/sync_core.h" | 5 #include "sync/internal_api/sync_core.h" |
| 6 | 6 |
| 7 #include "sync/engine/non_blocking_type_processor_core.h" | 7 #include "sync/engine/non_blocking_type_processor_core.h" |
| 8 #include "sync/sessions/model_type_registry.h" | 8 #include "sync/sessions/model_type_registry.h" |
| 9 | 9 |
| 10 namespace syncer { | 10 namespace syncer { |
| 11 | 11 |
| 12 SyncCore::SyncCore(ModelTypeRegistry* model_type_registry) | 12 SyncCore::SyncCore(ModelTypeRegistry* model_type_registry) |
| 13 : model_type_registry_(model_type_registry), weak_ptr_factory_(this) {} | 13 : model_type_registry_(model_type_registry), weak_ptr_factory_(this) {} |
| 14 | 14 |
| 15 SyncCore::~SyncCore() {} | 15 SyncCore::~SyncCore() {} |
| 16 | 16 |
| 17 void SyncCore::ConnectSyncTypeToCore( | 17 void SyncCore::ConnectSyncTypeToCore( |
| 18 ModelType type, | 18 ModelType type, |
| 19 const DataTypeState& data_type_state, |
| 19 scoped_refptr<base::SequencedTaskRunner> task_runner, | 20 scoped_refptr<base::SequencedTaskRunner> task_runner, |
| 20 base::WeakPtr<NonBlockingTypeProcessor> processor) { | 21 base::WeakPtr<NonBlockingTypeProcessor> processor) { |
| 21 | |
| 22 // Initialize the processor's sync-thread sibling and the | 22 // Initialize the processor's sync-thread sibling and the |
| 23 // processor <-> processor_core (ie. model thread <-> sync thread) | 23 // processor <-> processor_core (ie. model thread <-> sync thread) |
| 24 // communication channel. | 24 // communication channel. |
| 25 model_type_registry_->InitializeNonBlockingType(type, task_runner, processor); | 25 model_type_registry_->InitializeNonBlockingType( |
| 26 type, data_type_state, task_runner, processor); |
| 26 } | 27 } |
| 27 | 28 |
| 28 void SyncCore::Disconnect(ModelType type) { | 29 void SyncCore::Disconnect(ModelType type) { |
| 29 model_type_registry_->RemoveNonBlockingType(type); | 30 model_type_registry_->RemoveNonBlockingType(type); |
| 30 } | 31 } |
| 31 | 32 |
| 32 base::WeakPtr<SyncCore> SyncCore::AsWeakPtr() { | 33 base::WeakPtr<SyncCore> SyncCore::AsWeakPtr() { |
| 33 return weak_ptr_factory_.GetWeakPtr(); | 34 return weak_ptr_factory_.GetWeakPtr(); |
| 34 } | 35 } |
| 35 | 36 |
| 36 } // namespace syncer | 37 } // namespace syncer |
| OLD | NEW |