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

Unified Diff: content/common/gpu/client/gpu_channel_host.cc

Issue 1135943005: Revert of content/common: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: content/common/gpu/client/gpu_channel_host.cc
diff --git a/content/common/gpu/client/gpu_channel_host.cc b/content/common/gpu/client/gpu_channel_host.cc
index b4460bbb56e3d1e999349bca9e972f756bc3612b..475eeb1541f6a4a4cb402ff7034055f17549f5ff 100644
--- a/content/common/gpu/client/gpu_channel_host.cc
+++ b/content/common/gpu/client/gpu_channel_host.cc
@@ -7,10 +7,9 @@
#include <algorithm>
#include "base/bind.h"
-#include "base/location.h"
+#include "base/message_loop/message_loop.h"
+#include "base/message_loop/message_loop_proxy.h"
#include "base/posix/eintr_wrapper.h"
-#include "base/single_thread_task_runner.h"
-#include "base/thread_task_runner_handle.h"
#include "base/threading/thread_restrictions.h"
#include "base/trace_event/trace_event.h"
#include "content/common/gpu/client/command_buffer_proxy_impl.h"
@@ -23,6 +22,7 @@
#endif
using base::AutoLock;
+using base::MessageLoopProxy;
namespace content {
@@ -71,11 +71,13 @@
DCHECK(factory_->IsMainThread());
// Open a channel to the GPU process. We pass NULL as the main listener here
// since we need to filter everything to route it to the right thread.
- scoped_refptr<base::SingleThreadTaskRunner> io_task_runner =
- factory_->GetIOThreadTaskRunner();
- channel_ =
- IPC::SyncChannel::Create(channel_handle, IPC::Channel::MODE_CLIENT, NULL,
- io_task_runner.get(), true, shutdown_event);
+ scoped_refptr<base::MessageLoopProxy> io_loop = factory_->GetIOLoopProxy();
+ channel_ = IPC::SyncChannel::Create(channel_handle,
+ IPC::Channel::MODE_CLIENT,
+ NULL,
+ io_loop.get(),
+ true,
+ shutdown_event);
sync_filter_ = new IPC::SyncMessageFilter(shutdown_event);
@@ -184,11 +186,14 @@
// then set up a new connection, and the GPU channel and any
// view command buffers will all be associated with the same GPU
// process.
- scoped_refptr<base::SingleThreadTaskRunner> io_task_runner =
- factory_->GetIOThreadTaskRunner();
- io_task_runner->PostTask(
- FROM_HERE, base::Bind(&GpuChannelHost::MessageFilter::OnChannelError,
- channel_filter_.get()));
+ DCHECK(MessageLoopProxy::current().get());
+
+ scoped_refptr<base::MessageLoopProxy> io_loop =
+ factory_->GetIOLoopProxy();
+ io_loop->PostTask(
+ FROM_HERE,
+ base::Bind(&GpuChannelHost::MessageFilter::OnChannelError,
+ channel_filter_.get()));
}
return NULL;
@@ -282,20 +287,20 @@
void GpuChannelHost::AddRoute(
int route_id, base::WeakPtr<IPC::Listener> listener) {
- scoped_refptr<base::SingleThreadTaskRunner> io_task_runner =
- factory_->GetIOThreadTaskRunner();
- io_task_runner->PostTask(FROM_HERE,
- base::Bind(&GpuChannelHost::MessageFilter::AddRoute,
- channel_filter_.get(), route_id, listener,
- base::ThreadTaskRunnerHandle::Get()));
+ DCHECK(MessageLoopProxy::current().get());
+
+ scoped_refptr<base::MessageLoopProxy> io_loop = factory_->GetIOLoopProxy();
+ io_loop->PostTask(FROM_HERE,
+ base::Bind(&GpuChannelHost::MessageFilter::AddRoute,
+ channel_filter_.get(), route_id, listener,
+ MessageLoopProxy::current()));
}
void GpuChannelHost::RemoveRoute(int route_id) {
- scoped_refptr<base::SingleThreadTaskRunner> io_task_runner =
- factory_->GetIOThreadTaskRunner();
- io_task_runner->PostTask(
- FROM_HERE, base::Bind(&GpuChannelHost::MessageFilter::RemoveRoute,
- channel_filter_.get(), route_id));
+ scoped_refptr<base::MessageLoopProxy> io_loop = factory_->GetIOLoopProxy();
+ io_loop->PostTask(FROM_HERE,
+ base::Bind(&GpuChannelHost::MessageFilter::RemoveRoute,
+ channel_filter_.get(), route_id));
}
base::SharedMemoryHandle GpuChannelHost::ShareToGpuProcess(
@@ -382,12 +387,11 @@
void GpuChannelHost::MessageFilter::AddRoute(
int route_id,
base::WeakPtr<IPC::Listener> listener,
- scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
+ scoped_refptr<MessageLoopProxy> loop) {
DCHECK(listeners_.find(route_id) == listeners_.end());
- DCHECK(task_runner);
GpuListenerInfo info;
info.listener = listener;
- info.task_runner = task_runner;
+ info.loop = loop;
listeners_[route_id] = info;
}
@@ -408,10 +412,12 @@
return false;
const GpuListenerInfo& info = it->second;
- info.task_runner->PostTask(
+ info.loop->PostTask(
FROM_HERE,
- base::Bind(base::IgnoreResult(&IPC::Listener::OnMessageReceived),
- info.listener, message));
+ base::Bind(
+ base::IgnoreResult(&IPC::Listener::OnMessageReceived),
+ info.listener,
+ message));
return true;
}
@@ -430,8 +436,9 @@
it != listeners_.end();
it++) {
const GpuListenerInfo& info = it->second;
- info.task_runner->PostTask(
- FROM_HERE, base::Bind(&IPC::Listener::OnChannelError, info.listener));
+ info.loop->PostTask(
+ FROM_HERE,
+ base::Bind(&IPC::Listener::OnChannelError, info.listener));
}
listeners_.clear();
« no previous file with comments | « content/common/gpu/client/gpu_channel_host.h ('k') | content/common/gpu/client/gpu_video_decode_accelerator_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698