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

Unified Diff: content/common/gpu/gpu_channel.cc

Issue 1134113002: content/common: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix CrOS build. 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
« no previous file with comments | « content/common/gpu/gpu_channel.h ('k') | content/common/gpu/gpu_channel_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/gpu_channel.cc
diff --git a/content/common/gpu/gpu_channel.cc b/content/common/gpu/gpu_channel.cc
index c12c762c6004f725973182513535274cc6ac2cc7..2768eea2f41d3968ab8aec97ce446c4204ddcfca 100644
--- a/content/common/gpu/gpu_channel.cc
+++ b/content/common/gpu/gpu_channel.cc
@@ -13,9 +13,11 @@
#include "base/bind.h"
#include "base/command_line.h"
-#include "base/message_loop/message_loop_proxy.h"
+#include "base/location.h"
+#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
#include "base/strings/string_util.h"
+#include "base/thread_task_runner_handle.h"
#include "base/timer/timer.h"
#include "base/trace_event/trace_event.h"
#include "content/common/gpu/gpu_channel_manager.h"
@@ -77,13 +79,13 @@ class GpuChannelMessageFilter : public IPC::MessageFilter {
GpuChannelMessageFilter(
base::WeakPtr<GpuChannel> gpu_channel,
scoped_refptr<gpu::SyncPointManager> sync_point_manager,
- scoped_refptr<base::MessageLoopProxy> message_loop,
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner,
bool future_sync_points)
: preemption_state_(IDLE),
gpu_channel_(gpu_channel),
sender_(NULL),
sync_point_manager_(sync_point_manager),
- message_loop_(message_loop),
+ task_runner_(task_runner),
messages_forwarded_to_channel_(0),
a_stub_is_descheduled_(false),
future_sync_points_(future_sync_points) {}
@@ -127,14 +129,11 @@ class GpuChannelMessageFilter : public IPC::MessageFilter {
uint32 sync_point = sync_point_manager_->GenerateSyncPoint();
GpuCommandBufferMsg_InsertSyncPoint::WriteReplyParams(reply, sync_point);
Send(reply);
- message_loop_->PostTask(
+ task_runner_->PostTask(
FROM_HERE,
base::Bind(&GpuChannelMessageFilter::InsertSyncPointOnMainThread,
- gpu_channel_,
- sync_point_manager_,
- message.routing_id(),
- get<0>(retire),
- sync_point));
+ gpu_channel_, sync_point_manager_, message.routing_id(),
+ get<0>(retire), sync_point));
handled = true;
}
@@ -383,7 +382,7 @@ class GpuChannelMessageFilter : public IPC::MessageFilter {
base::WeakPtr<GpuChannel> gpu_channel_;
IPC::Sender* sender_;
scoped_refptr<gpu::SyncPointManager> sync_point_manager_;
- scoped_refptr<base::MessageLoopProxy> message_loop_;
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
scoped_refptr<gpu::PreemptionFlag> preempting_flag_;
std::queue<PendingMessage> pending_messages_;
@@ -437,24 +436,19 @@ GpuChannel::~GpuChannel() {
preempting_flag_->Reset();
}
-void GpuChannel::Init(base::MessageLoopProxy* io_message_loop,
+void GpuChannel::Init(base::SingleThreadTaskRunner* io_task_runner,
base::WaitableEvent* shutdown_event) {
DCHECK(!channel_.get());
// Map renderer ID to a (single) channel to that process.
- channel_ = IPC::SyncChannel::Create(channel_id_,
- IPC::Channel::MODE_SERVER,
- this,
- io_message_loop,
- false,
- shutdown_event);
-
- filter_ =
- new GpuChannelMessageFilter(weak_factory_.GetWeakPtr(),
- gpu_channel_manager_->sync_point_manager(),
- base::MessageLoopProxy::current(),
- allow_future_sync_points_);
- io_message_loop_ = io_message_loop;
+ channel_ =
+ IPC::SyncChannel::Create(channel_id_, IPC::Channel::MODE_SERVER, this,
+ io_task_runner, false, shutdown_event);
+
+ filter_ = new GpuChannelMessageFilter(
+ weak_factory_.GetWeakPtr(), gpu_channel_manager_->sync_point_manager(),
+ base::ThreadTaskRunnerHandle::Get(), allow_future_sync_points_);
+ io_task_runner_ = io_task_runner;
channel_->AddFilter(filter_.get());
pending_valuebuffer_state_ = new gpu::ValueStateMap();
}
@@ -540,7 +534,7 @@ void GpuChannel::OnScheduled() {
// defer newly received messages until the ones in the queue have all been
// handled by HandleMessage. HandleMessage is invoked as a
// task to prevent reentrancy.
- base::MessageLoop::current()->PostTask(
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::Bind(&GpuChannel::HandleMessage, weak_factory_.GetWeakPtr()));
handle_messages_scheduled_ = true;
@@ -559,11 +553,10 @@ void GpuChannel::StubSchedulingChanged(bool scheduled) {
if (a_stub_is_descheduled != a_stub_was_descheduled) {
if (preempting_flag_.get()) {
- io_message_loop_->PostTask(
+ io_task_runner_->PostTask(
FROM_HERE,
base::Bind(&GpuChannelMessageFilter::UpdateStubSchedulingState,
- filter_,
- a_stub_is_descheduled));
+ filter_, a_stub_is_descheduled));
}
}
}
@@ -642,8 +635,9 @@ void GpuChannel::RemoveRoute(int32 route_id) {
gpu::PreemptionFlag* GpuChannel::GetPreemptionFlag() {
if (!preempting_flag_.get()) {
preempting_flag_ = new gpu::PreemptionFlag;
- io_message_loop_->PostTask(
- FROM_HERE, base::Bind(
+ io_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(
&GpuChannelMessageFilter::SetPreemptingFlagAndSchedulingState,
filter_, preempting_flag_, num_stubs_descheduled_ > 0));
}
@@ -796,11 +790,9 @@ void GpuChannel::OnDestroyCommandBuffer(int32 route_id) {
void GpuChannel::MessageProcessed() {
messages_processed_++;
if (preempting_flag_.get()) {
- io_message_loop_->PostTask(
- FROM_HERE,
- base::Bind(&GpuChannelMessageFilter::MessageProcessed,
- filter_,
- messages_processed_));
+ io_task_runner_->PostTask(
+ FROM_HERE, base::Bind(&GpuChannelMessageFilter::MessageProcessed,
+ filter_, messages_processed_));
}
}
« no previous file with comments | « content/common/gpu/gpu_channel.h ('k') | content/common/gpu/gpu_channel_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698