summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbacker@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-31 16:29:04 +0000
committerbacker@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-31 16:29:04 +0000
commit7822132061ad3d7bb671334b2afd2b80133a6415 (patch)
tree6da24c2465eaffec6673cfd68ed4b95debfce5a8
parent2bf708f745e7f2435e2809286af0483424bd7f21 (diff)
downloadchromium_src-7822132061ad3d7bb671334b2afd2b80133a6415.zip
chromium_src-7822132061ad3d7bb671334b2afd2b80133a6415.tar.gz
chromium_src-7822132061ad3d7bb671334b2afd2b80133a6415.tar.bz2
Refactoring to use a new IPC message filter.
There were several ViewHostMsgs being sent to the GpuProcessHost via a RenderMessageFilter. This patch creates a GpuMessageFilter and renames the ViewHostMsgs to GpuHostMsgs. This will clean up some of the clutter in render_messages_internal and render_message_filter. It will also allow us to easily add new messages to the GpuProcessHost in the future. BUG=none TEST=by hand and trybots Review URL: http://codereview.chromium.org/6401003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73152 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/gpu_process_host.cc34
-rw-r--r--chrome/browser/gpu_process_host.h19
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc2
-rw-r--r--chrome/browser/renderer_host/gpu_message_filter.cc60
-rw-r--r--chrome/browser/renderer_host/gpu_message_filter.h43
-rw-r--r--chrome/browser/renderer_host/render_message_filter.cc28
-rw-r--r--chrome/browser/renderer_host/render_message_filter.h7
-rw-r--r--chrome/chrome_browser.gypi2
-rw-r--r--chrome/common/gpu_messages_internal.h34
-rw-r--r--chrome/common/render_messages_internal.h21
-rw-r--r--chrome/renderer/gpu_channel_host.cc6
-rw-r--r--chrome/renderer/render_thread.cc5
12 files changed, 168 insertions, 93 deletions
diff --git a/chrome/browser/gpu_process_host.cc b/chrome/browser/gpu_process_host.cc
index 91906af..1ced5c6 100644
--- a/chrome/browser/gpu_process_host.cc
+++ b/chrome/browser/gpu_process_host.cc
@@ -12,7 +12,7 @@
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/gpu_blacklist.h"
#include "chrome/browser/gpu_process_host_ui_shim.h"
-#include "chrome/browser/renderer_host/render_message_filter.h"
+#include "chrome/browser/renderer_host/gpu_message_filter.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_widget_host.h"
#include "chrome/browser/renderer_host/render_widget_host_view.h"
@@ -77,7 +77,7 @@ bool SendDelayedMsg(IPC::Message* reply_msg) {
return GpuProcessHost::Get()->Send(reply_msg);
}
-bool SendDelayedMsg(IPC::Message* reply, RenderMessageFilter* filter) {
+bool SendDelayedMsg(IPC::Message* reply, GpuMessageFilter* filter) {
return filter->Send(reply);
}
@@ -182,7 +182,7 @@ bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) {
}
void GpuProcessHost::EstablishGpuChannel(int renderer_id,
- RenderMessageFilter* filter) {
+ GpuMessageFilter* filter) {
DCHECK(CalledOnValidThread());
if (Send(new GpuMsg_EstablishChannel(renderer_id))) {
@@ -193,7 +193,7 @@ void GpuProcessHost::EstablishGpuChannel(int renderer_id,
}
void GpuProcessHost::Synchronize(IPC::Message* reply,
- RenderMessageFilter* filter) {
+ GpuMessageFilter* filter) {
DCHECK(CalledOnValidThread());
if (Send(new GpuMsg_Synchronize())) {
@@ -213,7 +213,7 @@ class CVCBThreadHopping {
int32 renderer_id,
const GPUCreateCommandBufferConfig& init_params,
IPC::Message* reply,
- scoped_refptr<RenderMessageFilter> filter);
+ scoped_refptr<GpuMessageFilter> filter);
// Get a window for the command buffer that we're creating.
static void GetViewWindow(
@@ -221,7 +221,7 @@ class CVCBThreadHopping {
int32 renderer_id,
const GPUCreateCommandBufferConfig& init_params,
IPC::Message* reply,
- scoped_refptr<RenderMessageFilter> filter);
+ scoped_refptr<GpuMessageFilter> filter);
};
void CVCBThreadHopping::DispatchIPCAndQueueReply(
@@ -230,7 +230,7 @@ void CVCBThreadHopping::DispatchIPCAndQueueReply(
int32 renderer_id,
const GPUCreateCommandBufferConfig& init_params,
IPC::Message* reply,
- scoped_refptr<RenderMessageFilter> filter) {
+ scoped_refptr<GpuMessageFilter> filter) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
GpuProcessHost* host = GpuProcessHost::Get();
@@ -241,7 +241,8 @@ void CVCBThreadHopping::DispatchIPCAndQueueReply(
GpuProcessHost::DelayedReply(reply, filter));
} else {
int32 route_id = MSG_ROUTING_NONE;
- ViewHostMsg_CreateViewCommandBuffer::WriteReplyParams(reply, route_id);
+ GpuHostMsg_CreateViewCommandBuffer::WriteReplyParams(
+ reply, route_id);
SendDelayedMsg(reply, filter);
}
}
@@ -251,7 +252,7 @@ void CVCBThreadHopping::GetViewWindow(
int32 renderer_id,
const GPUCreateCommandBufferConfig& init_params,
IPC::Message* reply,
- scoped_refptr<RenderMessageFilter> filter) {
+ scoped_refptr<GpuMessageFilter> filter) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
gfx::PluginWindowHandle window = gfx::kNullPluginWindow;
RenderProcessHost* process = RenderProcessHost::FromID(renderer_id);
@@ -290,17 +291,18 @@ void GpuProcessHost::CreateViewCommandBuffer(
int32 renderer_id,
const GPUCreateCommandBufferConfig& init_params,
IPC::Message* reply,
- RenderMessageFilter* filter) {
+ GpuMessageFilter* filter) {
DCHECK(CalledOnValidThread());
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, NewRunnableFunction(
&CVCBThreadHopping::GetViewWindow,
render_view_id, renderer_id, init_params, reply,
- static_cast<scoped_refptr<RenderMessageFilter> > (filter)));
+ static_cast<scoped_refptr<GpuMessageFilter> > (filter)));
}
-GpuProcessHost::ChannelRequest::ChannelRequest(RenderMessageFilter* filter)
+GpuProcessHost::ChannelRequest::ChannelRequest(
+ GpuMessageFilter* filter)
: filter(filter) {
}
@@ -308,7 +310,7 @@ GpuProcessHost::ChannelRequest::~ChannelRequest() {}
GpuProcessHost::DelayedReply::DelayedReply(
IPC::Message* reply,
- RenderMessageFilter* filter)
+ GpuMessageFilter* filter)
: reply(reply),
filter(filter) {
}
@@ -381,7 +383,7 @@ void GpuProcessHost::OnCommandBufferCreated(const int32 route_id) {
if (create_command_buffer_replies_.size() > 0) {
const DelayedReply& request =
create_command_buffer_replies_.front();
- ViewHostMsg_CreateViewCommandBuffer::WriteReplyParams(
+ GpuHostMsg_CreateViewCommandBuffer::WriteReplyParams(
request.reply, route_id);
SendDelayedMsg(request.reply, request.filter);
create_command_buffer_replies_.pop();
@@ -391,12 +393,12 @@ void GpuProcessHost::OnCommandBufferCreated(const int32 route_id) {
void GpuProcessHost::SendEstablishChannelReply(
const IPC::ChannelHandle& channel,
const GPUInfo& gpu_info,
- RenderMessageFilter* filter) {
+ GpuMessageFilter* filter) {
ViewMsg_GpuChannelEstablished* message =
new ViewMsg_GpuChannelEstablished(channel, gpu_info);
// If the renderer process is performing synchronous initialization,
// it needs to handle this message before receiving the reply for
- // the synchronous ViewHostMsg_SynchronizeGpu message.
+ // the synchronous GpuHostMsg_SynchronizeGpu message.
message->set_unblock(true);
filter->Send(message);
}
diff --git a/chrome/browser/gpu_process_host.h b/chrome/browser/gpu_process_host.h
index 57b7105..487e9ef 100644
--- a/chrome/browser/gpu_process_host.h
+++ b/chrome/browser/gpu_process_host.h
@@ -18,7 +18,7 @@
class GpuBlacklist;
struct GPUCreateCommandBufferConfig;
class GPUInfo;
-class RenderMessageFilter;
+class GpuMessageFilter;
namespace IPC {
struct ChannelHandle;
@@ -39,11 +39,12 @@ class GpuProcessHost : public BrowserChildProcessHost,
// Tells the GPU process to create a new channel for communication with a
// renderer. Will asynchronously send message to object with given routing id
// on completion.
- void EstablishGpuChannel(int renderer_id, RenderMessageFilter* filter);
+ void EstablishGpuChannel(int renderer_id,
+ GpuMessageFilter* filter);
// Sends a reply message later when the next GpuHostMsg_SynchronizeReply comes
// in.
- void Synchronize(IPC::Message* reply, RenderMessageFilter* filter);
+ void Synchronize(IPC::Message* reply, GpuMessageFilter* filter);
// Tells the GPU process to create a new command buffer that draws into the
// window associated with the given renderer.
@@ -52,7 +53,7 @@ class GpuProcessHost : public BrowserChildProcessHost,
int32 renderer_id,
const GPUCreateCommandBufferConfig& init_params,
IPC::Message* reply,
- RenderMessageFilter* filter);
+ GpuMessageFilter* filter);
// We need to hop threads when creating the command buffer.
// Let these tasks access our internals.
@@ -61,15 +62,15 @@ class GpuProcessHost : public BrowserChildProcessHost,
private:
// Used to queue pending channel requests.
struct ChannelRequest {
- explicit ChannelRequest(RenderMessageFilter* filter);
+ explicit ChannelRequest(GpuMessageFilter* filter);
~ChannelRequest();
// Used to send the reply message back to the renderer.
- scoped_refptr<RenderMessageFilter> filter;
+ scoped_refptr<GpuMessageFilter> filter;
};
struct DelayedReply {
- DelayedReply(IPC::Message* reply, RenderMessageFilter* filter);
+ DelayedReply(IPC::Message* reply, GpuMessageFilter* filter);
~DelayedReply();
// The delayed reply message which needs to be sent to the
@@ -77,7 +78,7 @@ class GpuProcessHost : public BrowserChildProcessHost,
IPC::Message* reply;
// Used to send the reply message back to the renderer.
- scoped_refptr<RenderMessageFilter> filter;
+ scoped_refptr<GpuMessageFilter> filter;
};
GpuProcessHost();
@@ -97,7 +98,7 @@ class GpuProcessHost : public BrowserChildProcessHost,
// Sends the response for establish channel request to the renderer.
void SendEstablishChannelReply(const IPC::ChannelHandle& channel,
const GPUInfo& gpu_info,
- RenderMessageFilter* filter);
+ GpuMessageFilter* filter);
// Sends outstanding replies to renderer processes. This is only called
// in error situations like the GPU process crashing -- but is necessary
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index 86e59c6..2e6066b 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -53,6 +53,7 @@
#include "chrome/browser/renderer_host/blob_message_filter.h"
#include "chrome/browser/renderer_host/database_message_filter.h"
#include "chrome/browser/renderer_host/file_utilities_message_filter.h"
+#include "chrome/browser/renderer_host/gpu_message_filter.h"
#include "chrome/browser/renderer_host/pepper_file_message_filter.h"
#include "chrome/browser/renderer_host/pepper_message_filter.h"
#include "chrome/browser/renderer_host/render_message_filter.h"
@@ -453,6 +454,7 @@ void BrowserRenderProcessHost::CreateMessageFilters() {
channel_->AddFilter(
GeolocationDispatcherHost::New(
id(), profile()->GetGeolocationPermissionContext()));
+ channel_->AddFilter(new GpuMessageFilter(id()));
channel_->AddFilter(new PepperFileMessageFilter(id(), profile()));
channel_->AddFilter(new PepperMessageFilter(profile()));
channel_->AddFilter(new speech_input::SpeechInputDispatcherHost(id()));
diff --git a/chrome/browser/renderer_host/gpu_message_filter.cc b/chrome/browser/renderer_host/gpu_message_filter.cc
new file mode 100644
index 0000000..ce410cb
--- /dev/null
+++ b/chrome/browser/renderer_host/gpu_message_filter.cc
@@ -0,0 +1,60 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/renderer_host/gpu_message_filter.h"
+
+#include "chrome/browser/gpu_process_host.h"
+#include "chrome/common/gpu_create_command_buffer_config.h"
+#include "chrome/common/gpu_messages.h"
+
+GpuMessageFilter::GpuMessageFilter(
+ int render_process_id)
+ : render_process_id_(render_process_id) {
+}
+
+GpuMessageFilter::~GpuMessageFilter() {
+ // This function should be called on the IO thread.
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+}
+
+bool GpuMessageFilter::OnMessageReceived(
+ const IPC::Message& message,
+ 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_CreateViewCommandBuffer,
+ OnCreateViewCommandBuffer)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP_EX()
+ return handled;
+}
+
+void GpuMessageFilter::OnDestruct() const {
+ BrowserThread::DeleteOnIOThread::Destruct(this);
+}
+
+void GpuMessageFilter::OnEstablishGpuChannel() {
+ GpuProcessHost::Get()->EstablishGpuChannel(render_process_id_, this);
+}
+
+void GpuMessageFilter::OnSynchronizeGpu(IPC::Message* reply) {
+ // We handle this message (and the other GPU process messages) here
+ // rather than handing the message to the GpuProcessHost for
+ // dispatch so that we can use the DELAY_REPLY macro to synthesize
+ // the reply message, and also send down a "this" pointer so that
+ // the GPU process host can send the reply later.
+ GpuProcessHost::Get()->Synchronize(reply, this);
+}
+
+void GpuMessageFilter::OnCreateViewCommandBuffer(
+ int32 render_view_id,
+ const GPUCreateCommandBufferConfig& init_params,
+ IPC::Message* reply) {
+ GpuProcessHost::Get()->CreateViewCommandBuffer(
+ render_view_id, render_process_id_, init_params, reply, this);
+}
diff --git a/chrome/browser/renderer_host/gpu_message_filter.h b/chrome/browser/renderer_host/gpu_message_filter.h
new file mode 100644
index 0000000..bb914d9
--- /dev/null
+++ b/chrome/browser/renderer_host/gpu_message_filter.h
@@ -0,0 +1,43 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_RENDERER_HOST_GPU_MESSAGE_FILTER_H_
+#define CHROME_BROWSER_RENDERER_HOST_GPU_MESSAGE_FILTER_H_
+#pragma once
+
+#include "chrome/browser/browser_message_filter.h"
+
+struct GPUCreateCommandBufferConfig;
+
+// A message filter for messages from the renderer to the GpuProcessHost
+// in the browser. Such messages are typically destined for the GPU process,
+// but need to be mediated by the browser.
+class GpuMessageFilter : public BrowserMessageFilter {
+ public:
+ explicit GpuMessageFilter(int render_process_id);
+
+ // BrowserMessageFilter methods:
+ virtual bool OnMessageReceived(const IPC::Message& message,
+ bool* message_was_ok);
+ virtual void OnDestruct() const;
+
+ private:
+ friend class BrowserThread;
+ friend class DeleteTask<GpuMessageFilter>;
+ virtual ~GpuMessageFilter();
+
+ // Message handlers called on the browser IO thread:
+ void OnEstablishGpuChannel();
+ void OnSynchronizeGpu(IPC::Message* reply);
+ void OnCreateViewCommandBuffer(
+ int32 render_view_id,
+ const GPUCreateCommandBufferConfig& init_params,
+ IPC::Message* reply);
+
+ int render_process_id_;
+
+ DISALLOW_COPY_AND_ASSIGN(GpuMessageFilter);
+};
+
+#endif // CHROME_BROWSER_RENDERER_HOST_GPU_MESSAGE_FILTER_H_
diff --git a/chrome/browser/renderer_host/render_message_filter.cc b/chrome/browser/renderer_host/render_message_filter.cc
index 0f66493..c0a4e43 100644
--- a/chrome/browser/renderer_host/render_message_filter.cc
+++ b/chrome/browser/renderer_host/render_message_filter.cc
@@ -23,7 +23,6 @@
#include "chrome/browser/clipboard_dispatcher.h"
#include "chrome/browser/download/download_types.h"
#include "chrome/browser/extensions/extension_message_service.h"
-#include "chrome/browser/gpu_process_host.h"
#include "chrome/browser/host_zoom_map.h"
#include "chrome/browser/metrics/histogram_synchronizer.h"
#include "chrome/browser/metrics/user_metrics.h"
@@ -48,7 +47,6 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_file_util.h"
#include "chrome/common/extensions/extension_message_bundle.h"
-#include "chrome/common/gpu_create_command_buffer_config.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/render_messages_params.h"
@@ -395,11 +393,6 @@ bool RenderMessageFilter::OnMessageReceived(const IPC::Message& message,
#if defined(USE_TCMALLOC)
IPC_MESSAGE_HANDLER(ViewHostMsg_RendererTcmalloc, OnRendererTcmalloc)
#endif
- IPC_MESSAGE_HANDLER(ViewHostMsg_EstablishGpuChannel, OnEstablishGpuChannel)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_SynchronizeGpu,
- OnSynchronizeGpu)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_CreateViewCommandBuffer,
- OnCreateViewCommandBuffer)
IPC_MESSAGE_HANDLER(ViewHostMsg_AsyncOpenFile, OnAsyncOpenFile)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP_EX()
@@ -1413,27 +1406,6 @@ void RenderMessageFilter::OnRendererTcmalloc(base::ProcessId pid,
}
#endif
-void RenderMessageFilter::OnEstablishGpuChannel() {
- GpuProcessHost::Get()->EstablishGpuChannel(render_process_id_, this);
-}
-
-void RenderMessageFilter::OnSynchronizeGpu(IPC::Message* reply) {
- // We handle this message (and the other GPU process messages) here
- // rather than handing the message to the GpuProcessHost for
- // dispatch so that we can use the DELAY_REPLY macro to synthesize
- // the reply message, and also send down a "this" pointer so that
- // the GPU process host can send the reply later.
- GpuProcessHost::Get()->Synchronize(reply, this);
-}
-
-void RenderMessageFilter::OnCreateViewCommandBuffer(
- int32 render_view_id,
- const GPUCreateCommandBufferConfig& init_params,
- IPC::Message* reply) {
- GpuProcessHost::Get()->CreateViewCommandBuffer(
- render_view_id, render_process_id_, init_params, reply, this);
-}
-
void RenderMessageFilter::OnGetExtensionMessageBundle(
const std::string& extension_id, IPC::Message* reply_msg) {
ChromeURLRequestContext* context = static_cast<ChromeURLRequestContext*>(
diff --git a/chrome/browser/renderer_host/render_message_filter.h b/chrome/browser/renderer_host/render_message_filter.h
index a16c2aa..9cc1e95 100644
--- a/chrome/browser/renderer_host/render_message_filter.h
+++ b/chrome/browser/renderer_host/render_message_filter.h
@@ -31,7 +31,6 @@
class ChromeURLRequestContext;
struct FontDescriptor;
-struct GPUCreateCommandBufferConfig;
class HostContentSettingsMap;
class HostZoomMap;
class NotificationsPrefsCache;
@@ -331,12 +330,6 @@ class RenderMessageFilter : public BrowserMessageFilter,
const std::string& extension_id,
const std::string& default_locale,
IPC::Message* reply_msg);
- void OnEstablishGpuChannel();
- void OnSynchronizeGpu(IPC::Message* reply);
- void OnCreateViewCommandBuffer(
- int32 render_view_id,
- const GPUCreateCommandBufferConfig& init_params,
- IPC::Message* reply);
void OnAsyncOpenFile(const IPC::Message& msg,
const FilePath& path,
int flags,
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 559bb13..a134ba9 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -2192,6 +2192,8 @@
'browser/renderer_host/accelerated_surface_container_mac.h',
'browser/renderer_host/accelerated_surface_container_manager_mac.cc',
'browser/renderer_host/accelerated_surface_container_manager_mac.h',
+ 'browser/renderer_host/gpu_message_filter.cc',
+ 'browser/renderer_host/gpu_message_filter.h',
'browser/renderer_host/gtk_im_context_wrapper.cc',
'browser/renderer_host/gtk_im_context_wrapper.h',
'browser/renderer_host/gtk_key_bindings_handler.cc',
diff --git a/chrome/common/gpu_messages_internal.h b/chrome/common/gpu_messages_internal.h
index 2b9ddd0..635362a 100644
--- a/chrome/common/gpu_messages_internal.h
+++ b/chrome/common/gpu_messages_internal.h
@@ -94,34 +94,52 @@ IPC_MESSAGE_CONTROL0(GpuMsg_Hang)
//------------------------------------------------------------------------------
// GPU Host Messages
-// These are messages from the GPU process to the browser.
-// Response to a GpuHostMsg_EstablishChannel message.
+// These are messages to the browser.
+
+// A renderer sends this when it wants to create a connection to the GPU
+// process. The browser will create the GPU process if necessary, and will
+// return a handle to the channel via a GpuChannelEstablished message.
+IPC_MESSAGE_CONTROL0(GpuHostMsg_EstablishGpuChannel)
+
+// A renderer sends this to the browser process to provide a synchronization
+// point for GPU operations, in particular to make sure the GPU channel has
+// been established.
+IPC_SYNC_MESSAGE_CONTROL0_0(GpuHostMsg_SynchronizeGpu)
+
+// A renderer sends this to the browser process when it wants to
+// create a GL context associated with the given view_id.
+IPC_SYNC_MESSAGE_CONTROL2_1(GpuHostMsg_CreateViewCommandBuffer,
+ int32, /* render_view_id */
+ GPUCreateCommandBufferConfig, /* init_params */
+ int32 /* route_id */)
+
+// Response from GPU to a GpuHostMsg_EstablishChannel message.
IPC_MESSAGE_CONTROL2(GpuHostMsg_ChannelEstablished,
IPC::ChannelHandle, /* channel_handle */
GPUInfo /* GPU logging stats */)
-// Respond to a GpuMsg_CreateViewCommandBuffer message.
+// Respond from GPU to a GpuMsg_CreateViewCommandBuffer message.
IPC_MESSAGE_CONTROL1(GpuHostMsg_CommandBufferCreated,
int32 /* route_id */)
-// Free the browser resources associated with the command buffer
-// (typically a window that was drawn into).
+// Request from GPU to free the browser resources associated with the
+// command buffer.
IPC_MESSAGE_CONTROL3(GpuHostMsg_DestroyCommandBuffer,
gfx::PluginWindowHandle, /* view */
int32, /* render_view_id */
int32 /* renderer_id */)
-// Response to a GpuMsg_CollectGraphicsInfo.
+// Response from GPU to a GpuMsg_CollectGraphicsInfo.
IPC_MESSAGE_CONTROL1(GpuHostMsg_GraphicsInfoCollected,
GPUInfo /* GPU logging stats */)
-// Add a GPU log message to the about:gpu page
+// Message from GPU to add a GPU log message to the about:gpu page.
IPC_MESSAGE_CONTROL3(GpuHostMsg_OnLogMessage,
int /*severity*/,
std::string /* header */,
std::string /* message */)
-// Response to a GpuMsg_Synchronize message.
+// Response from GPU to a GpuMsg_Synchronize message.
IPC_MESSAGE_CONTROL0(GpuHostMsg_SynchronizeReply)
#if defined(OS_LINUX)
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 250c77d..ba33f36 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -48,7 +48,6 @@
typedef std::map<std::string, std::string> SubstitutionMap;
class Value;
-struct GPUCreateCommandBufferConfig;
class GPUInfo;
class SkBitmap;
struct ThumbnailScore;
@@ -645,7 +644,7 @@ IPC_MESSAGE_ROUTED3(ViewMsg_HandleMessageFromExternalHost,
IPC_MESSAGE_ROUTED0(ViewMsg_DisassociateFromPopupCount)
// The browser sends this to a renderer process in response to a
-// ViewHostMsg_EstablishGpuChannel message.
+// GpuHostMsg_EstablishGpuChannel message.
IPC_MESSAGE_CONTROL2(ViewMsg_GpuChannelEstablished,
IPC::ChannelHandle /* handle to channel */,
GPUInfo /* stats about GPU process*/)
@@ -1534,24 +1533,6 @@ IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_OpenChannelToPepperPlugin,
base::ProcessHandle /* plugin_process_handle */,
IPC::ChannelHandle /* handle to channel */)
-// A renderer sends this to the browser process when it wants to
-// create connect to the GPU. The browser will create the GPU process if
-// necessary, and will return a handle to the channel via
-// a GpuChannelEstablished message.
-IPC_MESSAGE_CONTROL0(ViewHostMsg_EstablishGpuChannel)
-
-// A renderer sends this to the browser process to provide a synchronization
-// point for GPU operations, in particular to make sure the GPU channel has
-// been established.
-IPC_SYNC_MESSAGE_CONTROL0_0(ViewHostMsg_SynchronizeGpu)
-
-// A renderer sends this to the browser process when it wants to
-// create a GL context associated with the given view_id.
-IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_CreateViewCommandBuffer,
- int32, /* render_view_id */
- GPUCreateCommandBufferConfig, /* init_params */
- int32 /* route_id */)
-
// A renderer sends this to the browser process when it wants to start
// a new instance of the Native Client process. The browser will launch
// the process and return a handle to an IMC channel.
diff --git a/chrome/renderer/gpu_channel_host.cc b/chrome/renderer/gpu_channel_host.cc
index 10b52ed..c4354e7 100644
--- a/chrome/renderer/gpu_channel_host.cc
+++ b/chrome/renderer/gpu_channel_host.cc
@@ -7,7 +7,6 @@
#include "chrome/common/child_process.h"
#include "chrome/common/gpu_create_command_buffer_config.h"
#include "chrome/common/gpu_messages.h"
-#include "chrome/common/render_messages.h"
#include "chrome/renderer/command_buffer_proxy.h"
#include "chrome/renderer/gpu_video_service_host.h"
#include "chrome/renderer/render_thread.h"
@@ -102,8 +101,9 @@ CommandBufferProxy* GpuChannelHost::CreateViewCommandBuffer(
GPUCreateCommandBufferConfig init_params(allowed_extensions, attribs);
int32 route_id;
- if (!RenderThread::current()->Send(new ViewHostMsg_CreateViewCommandBuffer(
- render_view_id, init_params, &route_id))) {
+ if (!RenderThread::current()->Send(
+ new GpuHostMsg_CreateViewCommandBuffer(
+ render_view_id, init_params, &route_id))) {
return NULL;
}
diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc
index 2721173..8cd0500 100644
--- a/chrome/renderer/render_thread.cc
+++ b/chrome/renderer/render_thread.cc
@@ -31,6 +31,7 @@
#include "chrome/common/dom_storage_messages.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_set.h"
+#include "chrome/common/gpu_messages.h"
#include "chrome/common/plugin_messages.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/render_messages_params.h"
@@ -827,12 +828,12 @@ void RenderThread::EstablishGpuChannel() {
gpu_channel_ = new GpuChannelHost;
// Ask the browser for the channel name.
- Send(new ViewHostMsg_EstablishGpuChannel());
+ Send(new GpuHostMsg_EstablishGpuChannel());
}
GpuChannelHost* RenderThread::EstablishGpuChannelSync() {
EstablishGpuChannel();
- Send(new ViewHostMsg_SynchronizeGpu());
+ Send(new GpuHostMsg_SynchronizeGpu());
return GetGpuChannel();
}