Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(768)

Side by Side Diff: sync/internal_api/sync_context_proxy_impl.cc

Issue 375403002: Replace MessageLoopProxy with ThreadTaskRunnerHandle in src/sync/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/message_loop/message_loop_proxy.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h"
10 #include "sync/engine/non_blocking_sync_common.h" 11 #include "sync/engine/non_blocking_sync_common.h"
11 #include "sync/internal_api/public/sync_context.h" 12 #include "sync/internal_api/public/sync_context.h"
12 13
13 namespace syncer { 14 namespace syncer {
14 15
15 SyncContextProxyImpl::SyncContextProxyImpl( 16 SyncContextProxyImpl::SyncContextProxyImpl(
16 const scoped_refptr<base::SequencedTaskRunner>& sync_task_runner, 17 const scoped_refptr<base::SequencedTaskRunner>& sync_task_runner,
17 const base::WeakPtr<SyncContext>& sync_context) 18 const base::WeakPtr<SyncContext>& sync_context)
18 : sync_task_runner_(sync_task_runner), sync_context_(sync_context) { 19 : sync_task_runner_(sync_task_runner), sync_context_(sync_context) {
19 } 20 }
20 21
21 SyncContextProxyImpl::~SyncContextProxyImpl() { 22 SyncContextProxyImpl::~SyncContextProxyImpl() {
22 } 23 }
23 24
24 void SyncContextProxyImpl::ConnectTypeToSync( 25 void SyncContextProxyImpl::ConnectTypeToSync(
25 ModelType type, 26 ModelType type,
26 const DataTypeState& data_type_state, 27 const DataTypeState& data_type_state,
27 const base::WeakPtr<ModelTypeSyncProxyImpl>& type_sync_proxy) { 28 const base::WeakPtr<ModelTypeSyncProxyImpl>& type_sync_proxy) {
28 VLOG(1) << "ConnectTypeToSync: " << ModelTypeToString(type); 29 VLOG(1) << "ConnectTypeToSync: " << ModelTypeToString(type);
29 sync_task_runner_->PostTask(FROM_HERE, 30 sync_task_runner_->PostTask(FROM_HERE,
30 base::Bind(&SyncContext::ConnectSyncTypeToWorker, 31 base::Bind(&SyncContext::ConnectSyncTypeToWorker,
31 sync_context_, 32 sync_context_,
32 type, 33 type,
33 data_type_state, 34 data_type_state,
34 base::MessageLoopProxy::current(), 35 base::ThreadTaskRunnerHandle::Get(),
35 type_sync_proxy)); 36 type_sync_proxy));
36 } 37 }
37 38
38 void SyncContextProxyImpl::Disconnect(ModelType type) { 39 void SyncContextProxyImpl::Disconnect(ModelType type) {
39 sync_task_runner_->PostTask( 40 sync_task_runner_->PostTask(
40 FROM_HERE, 41 FROM_HERE,
41 base::Bind(&SyncContext::DisconnectSyncWorker, sync_context_, type)); 42 base::Bind(&SyncContext::DisconnectSyncWorker, sync_context_, type));
42 } 43 }
43 44
44 scoped_ptr<SyncContextProxy> SyncContextProxyImpl::Clone() const { 45 scoped_ptr<SyncContextProxy> SyncContextProxyImpl::Clone() const {
45 return scoped_ptr<SyncContextProxy>( 46 return scoped_ptr<SyncContextProxy>(
46 new SyncContextProxyImpl(sync_task_runner_, sync_context_)); 47 new SyncContextProxyImpl(sync_task_runner_, sync_context_));
47 } 48 }
48 49
49 } // namespace syncer 50 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698