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

Unified Diff: chrome/gpu/gpu_channel.cc

Issue 6343006: Route IPC through browser when creating a viewable command buffer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nit. Created 9 years, 11 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 | « chrome/gpu/gpu_channel.h ('k') | chrome/gpu/gpu_command_buffer_stub.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/gpu/gpu_channel.cc
diff --git a/chrome/gpu/gpu_channel.cc b/chrome/gpu/gpu_channel.cc
index 66b928ea336ec14e8e46e825d2e1806b86ff5253..5ef74e2e0ba5a295ccf5a4232dddb17c6bb23b46 100644
--- a/chrome/gpu/gpu_channel.cc
+++ b/chrome/gpu/gpu_channel.cc
@@ -71,6 +71,23 @@ bool GpuChannel::Send(IPC::Message* message) {
return channel_->Send(message);
}
+void GpuChannel::CreateViewCommandBuffer(
+ gfx::PluginWindowHandle window,
+ int32 render_view_id,
+ const GPUCreateCommandBufferConfig& init_params,
+ int32* route_id) {
+ *route_id = MSG_ROUTING_NONE;
+
+#if defined(ENABLE_GPU)
+ *route_id = GenerateRouteID();
+ scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub(
+ this, window, NULL, gfx::Size(), init_params.allowed_extensions,
+ init_params.attribs, 0, *route_id, renderer_id_, render_view_id));
+ router_.AddRoute(*route_id, stub.get());
+ stubs_.AddWithID(stub.release(), *route_id);
+#endif // ENABLE_GPU
+}
+
#if defined(OS_MACOSX)
void GpuChannel::AcceleratedSurfaceBuffersSwapped(
int32 route_id, uint64 swap_buffers_count) {
@@ -97,8 +114,6 @@ bool GpuChannel::IsRenderViewGone(int32 renderer_route_id) {
bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg)
- IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateViewCommandBuffer,
- OnCreateViewCommandBuffer)
IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateOffscreenCommandBuffer,
OnCreateOffscreenCommandBuffer)
IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyCommandBuffer,
@@ -118,53 +133,6 @@ int GpuChannel::GenerateRouteID() {
return ++last_id;
}
-void GpuChannel::OnCreateViewCommandBuffer(
- gfx::NativeViewId view_id,
- int32 render_view_id,
- const GPUCreateCommandBufferConfig& init_params,
- int32* route_id) {
- *route_id = MSG_ROUTING_NONE;
-
-#if defined(ENABLE_GPU)
-
- gfx::PluginWindowHandle handle = gfx::kNullPluginWindow;
-#if defined(OS_WIN)
- // TODO(apatrick): We don't actually need the window handle on the Windows
- // platform. At this point, it only indicates to the GpuCommandBufferStub
- // whether onscreen or offscreen rendering is requested. The window handle
- // that will be rendered to is the child compositor window and that window
- // handle is provided by the browser process. Looking at what we are doing on
- // this and other platforms, I think a redesign is in order here. Perhaps
- // on all platforms the renderer just indicates whether it wants onscreen or
- // offscreen rendering and the browser provides whichever platform specific
- // "render target" the GpuCommandBufferStub targets.
- handle = gfx::NativeViewFromId(view_id);
-#elif defined(OS_LINUX)
- // Ask the browser for the view's XID.
- gpu_thread_->Send(new GpuHostMsg_GetViewXID(view_id, &handle));
-#elif defined(OS_MACOSX)
- // On Mac OS X we currently pass a (fake) PluginWindowHandle for the
- // NativeViewId. We could allocate fake NativeViewIds on the browser
- // side as well, and map between those and PluginWindowHandles, but
- // this seems excessive.
- handle = static_cast<gfx::PluginWindowHandle>(
- static_cast<intptr_t>(view_id));
-#else
- // TODO(apatrick): This needs to be something valid for mac and linux.
- // Offscreen rendering will work on these platforms but not rendering to the
- // window.
- DCHECK_EQ(view_id, 0);
-#endif
-
- *route_id = GenerateRouteID();
- scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub(
- this, handle, NULL, gfx::Size(), init_params.allowed_extensions,
- init_params.attribs, 0, *route_id, renderer_id_, render_view_id));
- router_.AddRoute(*route_id, stub.get());
- stubs_.AddWithID(stub.release(), *route_id);
-#endif // ENABLE_GPU
-}
-
void GpuChannel::OnCreateOffscreenCommandBuffer(
int32 parent_route_id,
const gfx::Size& size,
« no previous file with comments | « chrome/gpu/gpu_channel.h ('k') | chrome/gpu/gpu_command_buffer_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698