| 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_proxy_impl.h" | 5 #include "sync/internal_api/sync_core_proxy_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "sync/engine/non_blocking_sync_common.h" |
| 10 #include "sync/internal_api/sync_core.h" | 11 #include "sync/internal_api/sync_core.h" |
| 11 | 12 |
| 12 namespace syncer { | 13 namespace syncer { |
| 13 | 14 |
| 14 SyncCoreProxyImpl::SyncCoreProxyImpl( | 15 SyncCoreProxyImpl::SyncCoreProxyImpl( |
| 15 scoped_refptr<base::SequencedTaskRunner> sync_task_runner, | 16 scoped_refptr<base::SequencedTaskRunner> sync_task_runner, |
| 16 base::WeakPtr<SyncCore> sync_core) | 17 base::WeakPtr<SyncCore> sync_core) |
| 17 : sync_task_runner_(sync_task_runner), | 18 : sync_task_runner_(sync_task_runner), |
| 18 sync_core_(sync_core) {} | 19 sync_core_(sync_core) {} |
| 19 | 20 |
| 20 SyncCoreProxyImpl::~SyncCoreProxyImpl() {} | 21 SyncCoreProxyImpl::~SyncCoreProxyImpl() {} |
| 21 | 22 |
| 22 void SyncCoreProxyImpl::ConnectTypeToCore( | 23 void SyncCoreProxyImpl::ConnectTypeToCore( |
| 23 ModelType type, | 24 ModelType type, |
| 25 const DataTypeState& data_type_state, |
| 24 base::WeakPtr<NonBlockingTypeProcessor> type_processor) { | 26 base::WeakPtr<NonBlockingTypeProcessor> type_processor) { |
| 25 VLOG(1) << "ConnectTypeToCore: " << ModelTypeToString(type); | 27 VLOG(1) << "ConnectTypeToCore: " << ModelTypeToString(type); |
| 26 sync_task_runner_->PostTask( | 28 sync_task_runner_->PostTask(FROM_HERE, |
| 27 FROM_HERE, | 29 base::Bind(&SyncCore::ConnectSyncTypeToCore, |
| 28 base::Bind(&SyncCore::ConnectSyncTypeToCore, | 30 sync_core_, |
| 29 sync_core_, | 31 type, |
| 30 type, | 32 data_type_state, |
| 31 base::MessageLoopProxy::current(), | 33 base::MessageLoopProxy::current(), |
| 32 type_processor)); | 34 type_processor)); |
| 33 } | 35 } |
| 34 | 36 |
| 35 void SyncCoreProxyImpl::Disconnect(ModelType type) { | 37 void SyncCoreProxyImpl::Disconnect(ModelType type) { |
| 36 sync_task_runner_->PostTask( | 38 sync_task_runner_->PostTask( |
| 37 FROM_HERE, base::Bind(&SyncCore::Disconnect, sync_core_, type)); | 39 FROM_HERE, base::Bind(&SyncCore::Disconnect, sync_core_, type)); |
| 38 } | 40 } |
| 39 | 41 |
| 40 scoped_ptr<SyncCoreProxy> SyncCoreProxyImpl::Clone() const { | 42 scoped_ptr<SyncCoreProxy> SyncCoreProxyImpl::Clone() const { |
| 41 return scoped_ptr<SyncCoreProxy>( | 43 return scoped_ptr<SyncCoreProxy>( |
| 42 new SyncCoreProxyImpl(sync_task_runner_, sync_core_)); | 44 new SyncCoreProxyImpl(sync_task_runner_, sync_core_)); |
| 43 } | 45 } |
| 44 | 46 |
| 45 } // namespace syncer | 47 } // namespace syncer |
| OLD | NEW |