summaryrefslogtreecommitdiffstats
path: root/content/browser/renderer_host
diff options
context:
space:
mode:
authorsievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-08 20:36:04 +0000
committersievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-08 20:36:04 +0000
commitb42a9f62685ff25438ec0fd689e4b8952b70dd70 (patch)
tree96cdea5d58fe5655f90e3c8c08ae412c9ab85b3d /content/browser/renderer_host
parent1f433b75a2d611bb9a96fb87b9d8f95558eb9a1e (diff)
downloadchromium_src-b42a9f62685ff25438ec0fd689e4b8952b70dd70.zip
chromium_src-b42a9f62685ff25438ec0fd689e4b8952b70dd70.tar.gz
chromium_src-b42a9f62685ff25438ec0fd689e4b8952b70dd70.tar.bz2
Make EstablishGpuChannel synchronous. Remove obsolete Synchronize msg.
This simplifies message routing to the compositor thread a bit. Review URL: http://codereview.chromium.org/7129006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88387 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/renderer_host')
-rw-r--r--content/browser/renderer_host/gpu_message_filter.cc70
-rw-r--r--content/browser/renderer_host/gpu_message_filter.h4
2 files changed, 18 insertions, 56 deletions
diff --git a/content/browser/renderer_host/gpu_message_filter.cc b/content/browser/renderer_host/gpu_message_filter.cc
index ca5647e..ce028b6 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,
diff --git a/content/browser/renderer_host/gpu_message_filter.h b/content/browser/renderer_host/gpu_message_filter.h
index 00f37e0..7246f5a 100644
--- a/content/browser/renderer_host/gpu_message_filter.h
+++ b/content/browser/renderer_host/gpu_message_filter.h
@@ -38,8 +38,8 @@ class GpuMessageFilter : public BrowserMessageFilter,
virtual ~GpuMessageFilter();
// Message handlers called on the browser IO thread:
- void OnEstablishGpuChannel(content::CauseForGpuLaunch);
- void OnSynchronizeGpu(IPC::Message* reply);
+ void OnEstablishGpuChannel(content::CauseForGpuLaunch,
+ IPC::Message* reply);
void OnCreateViewCommandBuffer(
gfx::PluginWindowHandle compositing_surface,
int32 render_view_id,