summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gpu_process_host.h
diff options
context:
space:
mode:
authorbacker@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-27 15:24:25 +0000
committerbacker@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-27 15:24:25 +0000
commitd8a58e44578fa646480cec37db3ddb40a5b673b7 (patch)
tree4221925985cab2e659d9b2a22434810361c1958a /chrome/browser/gpu_process_host.h
parent5ba9c9ae342ff20bde44be9dfc538727d3696865 (diff)
downloadchromium_src-d8a58e44578fa646480cec37db3ddb40a5b673b7.zip
chromium_src-d8a58e44578fa646480cec37db3ddb40a5b673b7.tar.gz
chromium_src-d8a58e44578fa646480cec37db3ddb40a5b673b7.tar.bz2
Route IPC through browser when creating a viewable command buffer.
The communications path for creating a viewable command buffer used to be directly from the renderer (gpu_channel.cc) to the gpu process (gpu_channel.cc). This patch makes the browser an intermediary: - renderer (gpu_channel.cc) makes a synchronous request to the browser (picked up in renderer_message_filter.cc and forwarded to gpu_process_host.cc) - browser (gpu_process_host.cc) makes an asynchronous request to the gpu process (picked up in gpu_thread.cc and forwarded to gpu_channel.cc) for the command buffer - gpu process (gpu_thread.cc) sends an ACK with the route_id for the command buffer back to the browser (gpu_process_host.cc) - browser (gpu_process_host.cc) sends a delayed reply back to the renderer (gpu_channel_host.cc), which had blocked There are several motivations for this patch: - creating an onscreen command buffer requires a window to draw into (which is acquired/locked in the browser); by routing through the browser, we can acquire the get the window beforehand (thereby preventing a deadlock in some other work that I'm doing) - we can eliminate several separate synchronous IPC messages for obtaining and releasing the window associated with drawing (I've tried to unify the different code paths for Linux, Windows, and Mac) - in the future, we can have the browser allocate SHM for the command buffer and transfer buffers, allowing us to sandbox the gpu process BUG=none TEST=by hand on all 3 platforms, trybots Review URL: http://codereview.chromium.org/6343006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72798 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gpu_process_host.h')
-rw-r--r--chrome/browser/gpu_process_host.h31
1 files changed, 23 insertions, 8 deletions
diff --git a/chrome/browser/gpu_process_host.h b/chrome/browser/gpu_process_host.h
index a1dfdc4..57b7105 100644
--- a/chrome/browser/gpu_process_host.h
+++ b/chrome/browser/gpu_process_host.h
@@ -16,6 +16,7 @@
#include "gfx/native_widget_types.h"
class GpuBlacklist;
+struct GPUCreateCommandBufferConfig;
class GPUInfo;
class RenderMessageFilter;
@@ -44,6 +45,19 @@ class GpuProcessHost : public BrowserChildProcessHost,
// in.
void Synchronize(IPC::Message* reply, RenderMessageFilter* filter);
+ // Tells the GPU process to create a new command buffer that draws into the
+ // window associated with the given renderer.
+ void CreateViewCommandBuffer(
+ int32 render_view_id,
+ int32 renderer_id,
+ const GPUCreateCommandBufferConfig& init_params,
+ IPC::Message* reply,
+ RenderMessageFilter* filter);
+
+ // We need to hop threads when creating the command buffer.
+ // Let these tasks access our internals.
+ friend class CVCBThreadHopping;
+
private:
// Used to queue pending channel requests.
struct ChannelRequest {
@@ -54,10 +68,9 @@ class GpuProcessHost : public BrowserChildProcessHost,
scoped_refptr<RenderMessageFilter> filter;
};
- // Used to queue pending synchronization requests.
- struct SynchronizationRequest {
- SynchronizationRequest(IPC::Message* reply, RenderMessageFilter* filter);
- ~SynchronizationRequest();
+ struct DelayedReply {
+ DelayedReply(IPC::Message* reply, RenderMessageFilter* filter);
+ ~DelayedReply();
// The delayed reply message which needs to be sent to the
// renderer.
@@ -79,14 +92,12 @@ class GpuProcessHost : public BrowserChildProcessHost,
void OnChannelEstablished(const IPC::ChannelHandle& channel_handle,
const GPUInfo& gpu_info);
void OnSynchronizeReply();
+ void OnCommandBufferCreated(const int32 route_id);
// Sends the response for establish channel request to the renderer.
void SendEstablishChannelReply(const IPC::ChannelHandle& channel,
const GPUInfo& gpu_info,
RenderMessageFilter* filter);
- // Sends the response for synchronization request to the renderer.
- void SendSynchronizationReply(IPC::Message* reply,
- RenderMessageFilter* filter);
// Sends outstanding replies to renderer processes. This is only called
// in error situations like the GPU process crashing -- but is necessary
@@ -114,9 +125,13 @@ class GpuProcessHost : public BrowserChildProcessHost,
std::queue<ChannelRequest> sent_requests_;
// The pending synchronization requests we need to reply to.
- std::queue<SynchronizationRequest> queued_synchronization_replies_;
+ std::queue<DelayedReply> queued_synchronization_replies_;
+
+ // The pending create command buffer requests we need to reply to.
+ std::queue<DelayedReply> create_command_buffer_replies_;
DISALLOW_COPY_AND_ASSIGN(GpuProcessHost);
};
+
#endif // CHROME_BROWSER_GPU_PROCESS_HOST_H_