diff options
author | anujk.sharma <anujk.sharma@samsung.com> | 2015-05-05 05:00:55 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-05 12:01:34 +0000 |
commit | 332a1b2b1d5635199d5ed453f5f9586b2e030b64 (patch) | |
tree | cdf677fa1a51b3f8628b563c0333c0fed8dfb0cd /mojo | |
parent | 6a179254d7d55b3987eb4d1a2c64aa5ad1de5d76 (diff) | |
download | chromium_src-332a1b2b1d5635199d5ed453f5f9586b2e030b64.zip chromium_src-332a1b2b1d5635199d5ed453f5f9586b2e030b64.tar.gz chromium_src-332a1b2b1d5635199d5ed453f5f9586b2e030b64.tar.bz2 |
Replace MessageLoopProxy usage with ThreadTaskRunnerHandle in mojo module.
MessageLoopProxy is deprecated.
This basically does a search and replace:
MessageLoopProxy::current() -> ThreadTaskRunnerHandle::Get().
BUG=391045
Review URL: https://codereview.chromium.org/1118473002
Cr-Commit-Position: refs/heads/master@{#328311}
Diffstat (limited to 'mojo')
-rw-r--r-- | mojo/application/content_handler_factory.cc | 18 | ||||
-rw-r--r-- | mojo/common/handle_watcher.cc | 15 | ||||
-rw-r--r-- | mojo/runner/child_process.cc | 6 | ||||
-rw-r--r-- | mojo/runner/in_process_native_runner.cc | 8 |
4 files changed, 28 insertions, 19 deletions
diff --git a/mojo/application/content_handler_factory.cc b/mojo/application/content_handler_factory.cc index 8518f4c..a7e5d2c 100644 --- a/mojo/application/content_handler_factory.cc +++ b/mojo/application/content_handler_factory.cc @@ -9,6 +9,8 @@ #include "base/bind.h" #include "base/callback.h" #include "base/memory/weak_ptr.h" +#include "base/single_thread_task_runner.h" +#include "base/thread_task_runner_handle.h" #include "base/threading/platform_thread.h" #include "mojo/application/application_runner_chromium.h" #include "mojo/common/message_pump_mojo.h" @@ -25,7 +27,7 @@ namespace { class ApplicationThread : public base::PlatformThread::Delegate { public: ApplicationThread( - scoped_refptr<base::MessageLoopProxy> handler_thread, + scoped_refptr<base::SingleThreadTaskRunner> handler_thread, const base::Callback<void(ApplicationThread*)>& termination_callback, ContentHandlerFactory::Delegate* handler_delegate, InterfaceRequest<Application> application_request, @@ -44,7 +46,7 @@ class ApplicationThread : public base::PlatformThread::Delegate { base::Bind(termination_callback_, this)); } - scoped_refptr<base::MessageLoopProxy> handler_thread_; + scoped_refptr<base::SingleThreadTaskRunner> handler_thread_; base::Callback<void(ApplicationThread*)> termination_callback_; ContentHandlerFactory::Delegate* handler_delegate_; InterfaceRequest<Application> application_request_; @@ -76,11 +78,13 @@ class ContentHandlerImpl : public ContentHandler { // Overridden from ContentHandler: void StartApplication(InterfaceRequest<Application> application_request, URLResponsePtr response) override { - ApplicationThread* thread = new ApplicationThread( - base::MessageLoopProxy::current(), - base::Bind(&ContentHandlerImpl::OnThreadEnd, - weak_factory_.GetWeakPtr()), - delegate_, application_request.Pass(), response.Pass()); + ApplicationThread* thread = + new ApplicationThread(base::ThreadTaskRunnerHandle::Get(), + base::Bind(&ContentHandlerImpl::OnThreadEnd, + weak_factory_.GetWeakPtr()), + delegate_, + application_request.Pass(), + response.Pass()); base::PlatformThreadHandle handle; bool launched = base::PlatformThread::Create(0, thread, &handle); DCHECK(launched); diff --git a/mojo/common/handle_watcher.cc b/mojo/common/handle_watcher.cc index 79cdcdb..8d20b16 100644 --- a/mojo/common/handle_watcher.cc +++ b/mojo/common/handle_watcher.cc @@ -14,9 +14,10 @@ #include "base/memory/singleton.h" #include "base/memory/weak_ptr.h" #include "base/message_loop/message_loop.h" -#include "base/message_loop/message_loop_proxy.h" +#include "base/single_thread_task_runner.h" #include "base/synchronization/lock.h" #include "base/synchronization/waitable_event.h" +#include "base/thread_task_runner_handle.h" #include "base/threading/thread.h" #include "base/threading/thread_restrictions.h" #include "base/time/time.h" @@ -43,14 +44,14 @@ struct WatchData { WatchData() : id(0), handle_signals(MOJO_HANDLE_SIGNAL_NONE), - message_loop(NULL) {} + task_runner(NULL) {} WatcherID id; Handle handle; MojoHandleSignals handle_signals; base::TimeTicks deadline; base::Callback<void(MojoResult)> callback; - scoped_refptr<base::MessageLoopProxy> message_loop; + scoped_refptr<base::SingleThreadTaskRunner> task_runner; }; // WatcherBackend -------------------------------------------------------------- @@ -124,7 +125,7 @@ void WatcherBackend::RemoveAndNotify(const Handle& handle, handle_to_data_.erase(handle); MessagePumpMojo::current()->RemoveHandler(handle); - data.message_loop->PostTask(FROM_HERE, base::Bind(data.callback, result)); + data.task_runner->PostTask(FROM_HERE, base::Bind(data.callback, result)); } bool WatcherBackend::GetMojoHandleByWatcherID(WatcherID watcher_id, @@ -238,9 +239,9 @@ WatcherID WatcherThreadManager::StartWatching( request_data.start_data.callback = callback; request_data.start_data.handle_signals = handle_signals; request_data.start_data.deadline = deadline; - request_data.start_data.message_loop = base::MessageLoopProxy::current(); - DCHECK_NE(static_cast<base::MessageLoopProxy*>(NULL), - request_data.start_data.message_loop.get()); + request_data.start_data.task_runner = base::ThreadTaskRunnerHandle::Get(); + DCHECK_NE(static_cast<base::SingleThreadTaskRunner*>(NULL), + request_data.start_data.task_runner.get()); AddRequest(request_data); return request_data.start_data.id; } diff --git a/mojo/runner/child_process.cc b/mojo/runner/child_process.cc index 3553193..060308b 100644 --- a/mojo/runner/child_process.cc +++ b/mojo/runner/child_process.cc @@ -18,6 +18,7 @@ #include "base/message_loop/message_loop.h" #include "base/single_thread_task_runner.h" #include "base/synchronization/waitable_event.h" +#include "base/thread_task_runner_handle.h" #include "base/threading/thread.h" #include "base/threading/thread_checker.h" #include "mojo/common/message_pump_mojo.h" @@ -191,10 +192,11 @@ class ChildControllerImpl : public ChildController, public ErrorHandler { new ChildControllerImpl(app_context, unblocker)); ScopedMessagePipeHandle host_message_pipe(embedder::CreateChannel( - platform_channel.Pass(), app_context->io_runner(), + platform_channel.Pass(), + app_context->io_runner(), base::Bind(&ChildControllerImpl::DidCreateChannel, base::Unretained(impl.get())), - base::MessageLoopProxy::current())); + base::ThreadTaskRunnerHandle::Get())); impl->Bind(host_message_pipe.Pass()); diff --git a/mojo/runner/in_process_native_runner.cc b/mojo/runner/in_process_native_runner.cc index c37e31d..27b6c3d 100644 --- a/mojo/runner/in_process_native_runner.cc +++ b/mojo/runner/in_process_native_runner.cc @@ -7,7 +7,7 @@ #include "base/bind.h" #include "base/callback_helpers.h" #include "base/location.h" -#include "base/message_loop/message_loop_proxy.h" +#include "base/thread_task_runner_handle.h" #include "base/threading/platform_thread.h" #include "mojo/runner/native_application_support.h" @@ -43,8 +43,10 @@ void InProcessNativeRunner::Start( DCHECK(app_completed_callback_runner_.is_null()); app_completed_callback_runner_ = - base::Bind(&base::TaskRunner::PostTask, base::MessageLoopProxy::current(), - FROM_HERE, app_completed_callback); + base::Bind(&base::TaskRunner::PostTask, + base::ThreadTaskRunnerHandle::Get(), + FROM_HERE, + app_completed_callback); DCHECK(!thread_); thread_.reset(new base::DelegateSimpleThread(this, "app_thread")); |