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

Side by Side Diff: sync/sessions/model_type_registry.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/sessions/model_type_registry.h" 5 #include "sync/sessions/model_type_registry.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop_proxy.h"
9 #include "base/observer_list.h" 8 #include "base/observer_list.h"
9 #include "base/thread_task_runner_handle.h"
10 #include "sync/engine/directory_commit_contributor.h" 10 #include "sync/engine/directory_commit_contributor.h"
11 #include "sync/engine/directory_update_handler.h" 11 #include "sync/engine/directory_update_handler.h"
12 #include "sync/engine/model_type_sync_proxy.h" 12 #include "sync/engine/model_type_sync_proxy.h"
13 #include "sync/engine/model_type_sync_proxy_impl.h" 13 #include "sync/engine/model_type_sync_proxy_impl.h"
14 #include "sync/engine/model_type_sync_worker.h" 14 #include "sync/engine/model_type_sync_worker.h"
15 #include "sync/engine/model_type_sync_worker_impl.h" 15 #include "sync/engine/model_type_sync_worker_impl.h"
16 #include "sync/engine/non_blocking_sync_common.h" 16 #include "sync/engine/non_blocking_sync_common.h"
17 #include "sync/sessions/directory_type_debug_info_emitter.h" 17 #include "sync/sessions/directory_type_debug_info_emitter.h"
18 18
19 namespace syncer { 19 namespace syncer {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // Initialize Worker -> Proxy communication channel. 193 // Initialize Worker -> Proxy communication channel.
194 scoped_ptr<ModelTypeSyncProxy> proxy( 194 scoped_ptr<ModelTypeSyncProxy> proxy(
195 new ModelTypeSyncProxyWrapper(proxy_impl, type_task_runner)); 195 new ModelTypeSyncProxyWrapper(proxy_impl, type_task_runner));
196 scoped_ptr<ModelTypeSyncWorkerImpl> worker( 196 scoped_ptr<ModelTypeSyncWorkerImpl> worker(
197 new ModelTypeSyncWorkerImpl(type, data_type_state, proxy.Pass())); 197 new ModelTypeSyncWorkerImpl(type, data_type_state, proxy.Pass()));
198 198
199 // Initialize Proxy -> Worker communication channel. 199 // Initialize Proxy -> Worker communication channel.
200 scoped_ptr<ModelTypeSyncWorker> wrapped_worker( 200 scoped_ptr<ModelTypeSyncWorker> wrapped_worker(
201 new ModelTypeSyncWorkerWrapper(worker->AsWeakPtr(), 201 new ModelTypeSyncWorkerWrapper(worker->AsWeakPtr(),
202 scoped_refptr<base::SequencedTaskRunner>( 202 scoped_refptr<base::SequencedTaskRunner>(
203 base::MessageLoopProxy::current()))); 203 base::ThreadTaskRunnerHandle::Get())));
204 type_task_runner->PostTask(FROM_HERE, 204 type_task_runner->PostTask(FROM_HERE,
205 base::Bind(&ModelTypeSyncProxyImpl::OnConnect, 205 base::Bind(&ModelTypeSyncProxyImpl::OnConnect,
206 proxy_impl, 206 proxy_impl,
207 base::Passed(&wrapped_worker))); 207 base::Passed(&wrapped_worker)));
208 208
209 DCHECK(update_handler_map_.find(type) == update_handler_map_.end()); 209 DCHECK(update_handler_map_.find(type) == update_handler_map_.end());
210 DCHECK(commit_contributor_map_.find(type) == commit_contributor_map_.end()); 210 DCHECK(commit_contributor_map_.find(type) == commit_contributor_map_.end());
211 211
212 update_handler_map_.insert(std::make_pair(type, worker.get())); 212 update_handler_map_.insert(std::make_pair(type, worker.get()));
213 commit_contributor_map_.insert(std::make_pair(type, worker.get())); 213 commit_contributor_map_.insert(std::make_pair(type, worker.get()));
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 for (ScopedVector<ModelTypeSyncWorkerImpl>::const_iterator it = 298 for (ScopedVector<ModelTypeSyncWorkerImpl>::const_iterator it =
299 model_type_sync_workers_.begin(); 299 model_type_sync_workers_.begin();
300 it != model_type_sync_workers_.end(); 300 it != model_type_sync_workers_.end();
301 ++it) { 301 ++it) {
302 enabled_off_thread_types.Put((*it)->GetModelType()); 302 enabled_off_thread_types.Put((*it)->GetModelType());
303 } 303 }
304 return enabled_off_thread_types; 304 return enabled_off_thread_types;
305 } 305 }
306 306
307 } // namespace syncer 307 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698