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_context_proxy_impl.h" | 5 #include "sync/internal_api/sync_context_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/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
11 #include "sync/internal_api/public/non_blocking_sync_common.h" | 11 #include "sync/internal_api/public/non_blocking_sync_common.h" |
12 #include "sync/internal_api/public/sync_context.h" | 12 #include "sync/internal_api/public/sync_context.h" |
13 | 13 |
14 namespace syncer_v2 { | 14 namespace syncer_v2 { |
15 | 15 |
16 SyncContextProxyImpl::SyncContextProxyImpl( | 16 SyncContextProxyImpl::SyncContextProxyImpl( |
17 const scoped_refptr<base::SequencedTaskRunner>& sync_task_runner, | 17 const scoped_refptr<base::SequencedTaskRunner>& sync_task_runner, |
18 const base::WeakPtr<SyncContext>& sync_context) | 18 const base::WeakPtr<SyncContext>& sync_context) |
19 : sync_task_runner_(sync_task_runner), sync_context_(sync_context) { | 19 : sync_task_runner_(sync_task_runner), sync_context_(sync_context) { |
20 } | 20 } |
21 | 21 |
22 SyncContextProxyImpl::~SyncContextProxyImpl() { | 22 SyncContextProxyImpl::~SyncContextProxyImpl() { |
23 } | 23 } |
24 | 24 |
25 void SyncContextProxyImpl::ConnectTypeToSync( | 25 void SyncContextProxyImpl::ConnectTypeToSync( |
26 syncer::ModelType type, | 26 syncer::ModelType type, |
27 const DataTypeState& data_type_state, | 27 const DataTypeState& data_type_state, |
28 const UpdateResponseDataList& saved_pending_updates, | 28 const UpdateResponseDataList& saved_pending_updates, |
29 const base::WeakPtr<syncer::ModelTypeSyncProxyImpl>& type_sync_proxy) { | 29 const base::WeakPtr<ModelTypeSyncProxyImpl>& type_sync_proxy) { |
30 VLOG(1) << "ConnectTypeToSync: " << ModelTypeToString(type); | 30 VLOG(1) << "ConnectTypeToSync: " << ModelTypeToString(type); |
31 sync_task_runner_->PostTask(FROM_HERE, | 31 sync_task_runner_->PostTask(FROM_HERE, |
32 base::Bind(&SyncContext::ConnectSyncTypeToWorker, | 32 base::Bind(&SyncContext::ConnectSyncTypeToWorker, |
33 sync_context_, | 33 sync_context_, |
34 type, | 34 type, |
35 data_type_state, | 35 data_type_state, |
36 saved_pending_updates, | 36 saved_pending_updates, |
37 base::ThreadTaskRunnerHandle::Get(), | 37 base::ThreadTaskRunnerHandle::Get(), |
38 type_sync_proxy)); | 38 type_sync_proxy)); |
39 } | 39 } |
40 | 40 |
41 void SyncContextProxyImpl::Disconnect(syncer::ModelType type) { | 41 void SyncContextProxyImpl::Disconnect(syncer::ModelType type) { |
42 sync_task_runner_->PostTask( | 42 sync_task_runner_->PostTask( |
43 FROM_HERE, | 43 FROM_HERE, |
44 base::Bind(&SyncContext::DisconnectSyncWorker, sync_context_, type)); | 44 base::Bind(&SyncContext::DisconnectSyncWorker, sync_context_, type)); |
45 } | 45 } |
46 | 46 |
47 scoped_ptr<SyncContextProxy> SyncContextProxyImpl::Clone() const { | 47 scoped_ptr<SyncContextProxy> SyncContextProxyImpl::Clone() const { |
48 return scoped_ptr<SyncContextProxy>( | 48 return scoped_ptr<SyncContextProxy>( |
49 new SyncContextProxyImpl(sync_task_runner_, sync_context_)); | 49 new SyncContextProxyImpl(sync_task_runner_, sync_context_)); |
50 } | 50 } |
51 | 51 |
52 } // namespace syncer | 52 } // namespace syncer |
OLD | NEW |