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

Unified Diff: content/browser/renderer_host/gpu_message_filter.cc

Issue 7129006: Make EstablishGpuChannel synchronous. Remove obsolete Synchronize msg. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: fix indentation and rebase Created 9 years, 6 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/browser/renderer_host/gpu_message_filter.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/browser/renderer_host/gpu_message_filter.cc
diff --git a/content/browser/renderer_host/gpu_message_filter.cc b/content/browser/renderer_host/gpu_message_filter.cc
index ca5647ee80ba80db9f281feac97cf46f0eb71362..ce028b6965221fd7487666a3e0cd59dc55020476 100644
--- a/content/browser/renderer_host/gpu_message_filter.cc
+++ b/content/browser/renderer_host/gpu_message_filter.cc
@@ -28,10 +28,8 @@ bool GpuMessageFilter::OnMessageReceived(
bool* message_was_ok) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP_EX(GpuMessageFilter, message, *message_was_ok)
- IPC_MESSAGE_HANDLER(GpuHostMsg_EstablishGpuChannel,
- OnEstablishGpuChannel)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_SynchronizeGpu,
- OnSynchronizeGpu)
+ IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_EstablishGpuChannel,
+ OnEstablishGpuChannel)
IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_CreateViewCommandBuffer,
OnCreateViewCommandBuffer)
IPC_MESSAGE_UNHANDLED(handled = false)
@@ -51,8 +49,10 @@ class EstablishChannelCallback
base::ProcessHandle,
const GPUInfo&> > {
public:
- explicit EstablishChannelCallback(GpuMessageFilter* filter):
- filter_(filter->AsWeakPtr()) {
+ explicit EstablishChannelCallback(GpuMessageFilter* filter,
+ IPC::Message* reply) :
+ filter_(filter->AsWeakPtr()),
+ reply_(reply) {
}
virtual void RunWithParams(const TupleType& params) {
@@ -84,35 +84,11 @@ class EstablishChannelCallback
renderer_process_for_gpu = 0;
}
- IPC::Message* reply = new GpuMsg_GpuChannelEstablished(
- channel, renderer_process_for_gpu, gpu_info);
-
- // If the renderer process is performing synchronous initialization,
- // it needs to handle this message before receiving the reply for
- // the synchronous GpuHostMsg_SynchronizeGpu message.
- reply->set_unblock(true);
-
- filter_->Send(reply);
- }
-
- private:
- base::WeakPtr<GpuMessageFilter> filter_;
-};
-
-class SynchronizeCallback : public CallbackRunner<Tuple0> {
- public:
- SynchronizeCallback(GpuMessageFilter* filter, IPC::Message* reply):
- filter_(filter->AsWeakPtr()),
- reply_(reply) {
- }
-
- virtual void RunWithParams(const TupleType& params) {
- DispatchToMethod(this, &SynchronizeCallback::Send, params);
- }
-
- void Send() {
- if (filter_)
- filter_->Send(reply_);
+ GpuHostMsg_EstablishGpuChannel::WriteReplyParams(reply_,
+ channel,
+ renderer_process_for_gpu,
+ gpu_info);
+ filter_->Send(reply_);
}
private:
@@ -148,9 +124,10 @@ class CreateCommandBufferCallback : public CallbackRunner<Tuple1<int32> > {
} // namespace
void GpuMessageFilter::OnEstablishGpuChannel(
- content::CauseForGpuLaunch cause_for_gpu_launch) {
+ content::CauseForGpuLaunch cause_for_gpu_launch,
+ IPC::Message* reply) {
scoped_ptr<EstablishChannelCallback> callback(
- new EstablishChannelCallback(this));
+ new EstablishChannelCallback(this, reply));
// TODO(apatrick): Eventually, this will return the route ID of a
// GpuProcessStub, from which the renderer process will create a
@@ -164,9 +141,8 @@ void GpuMessageFilter::OnEstablishGpuChannel(
host = GpuProcessHost::GetForRenderer(
render_process_id_, cause_for_gpu_launch);
if (!host) {
- callback->Run(IPC::ChannelHandle(),
- static_cast<base::ProcessHandle>(NULL),
- GPUInfo());
+ reply->set_reply_error();
+ Send(reply);
return;
}
@@ -176,20 +152,6 @@ void GpuMessageFilter::OnEstablishGpuChannel(
host->EstablishGpuChannel(render_process_id_, callback.release());
}
-void GpuMessageFilter::OnSynchronizeGpu(IPC::Message* reply) {
- GpuProcessHost* host = GpuProcessHost::FromID(gpu_host_id_);
- if (!host) {
- // TODO(apatrick): Eventually, this IPC message will be routed to a
- // GpuProcessStub with a particular routing ID. The error will be set if
- // the GpuProcessStub with that routing ID is not in the MessageRouter.
- reply->set_reply_error();
- Send(reply);
- return;
- }
-
- host->Synchronize(new SynchronizeCallback(this, reply));
-}
-
void GpuMessageFilter::OnCreateViewCommandBuffer(
gfx::PluginWindowHandle compositing_surface,
int32 render_view_id,
« no previous file with comments | « content/browser/renderer_host/gpu_message_filter.h ('k') | content/common/gpu/gpu_channel_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698