summaryrefslogtreecommitdiffstats
path: root/chrome/gpu/gpu_thread.cc
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-05 21:53:50 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-05 21:53:50 +0000
commit246a7045b9c45620fd725210aac51322e611c83f (patch)
tree6bdce605ae758c282a2b27e92a6b223d98b8d46a /chrome/gpu/gpu_thread.cc
parentc3240722a63ff142684575e3ea4eb89915edae72 (diff)
downloadchromium_src-246a7045b9c45620fd725210aac51322e611c83f.zip
chromium_src-246a7045b9c45620fd725210aac51322e611c83f.tar.gz
chromium_src-246a7045b9c45620fd725210aac51322e611c83f.tar.bz2
Added support for opening a GPU command buffer from a renderer processes through a GPU channel.
Probably only works in windows only so far. TEST=none BUG=none Review URL: http://codereview.chromium.org/657046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40783 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/gpu/gpu_thread.cc')
-rw-r--r--chrome/gpu/gpu_thread.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/chrome/gpu/gpu_thread.cc b/chrome/gpu/gpu_thread.cc
index 4c9a974..1839412 100644
--- a/chrome/gpu/gpu_thread.cc
+++ b/chrome/gpu/gpu_thread.cc
@@ -5,7 +5,9 @@
#include "chrome/gpu/gpu_thread.h"
#include "build/build_config.h"
+#include "chrome/common/child_process.h"
#include "chrome/common/gpu_messages.h"
+#include "chrome/gpu/gpu_channel.h"
#include "chrome/gpu/gpu_config.h"
#if defined(OS_WIN)
@@ -37,11 +39,30 @@ GpuBackingStoreGLXContext* GpuThread::GetGLXContext() {
void GpuThread::OnControlMessageReceived(const IPC::Message& msg) {
bool msg_is_ok = true;
IPC_BEGIN_MESSAGE_MAP_EX(GpuThread, msg, msg_is_ok)
+ IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel,
+ OnEstablishChannel)
IPC_MESSAGE_HANDLER(GpuMsg_NewRenderWidgetHostView,
OnNewRenderWidgetHostView)
IPC_END_MESSAGE_MAP_EX()
}
+void GpuThread::OnEstablishChannel(int renderer_id) {
+ scoped_refptr<GpuChannel> channel =
+ GpuChannel::EstablishGpuChannel(renderer_id);
+ IPC::ChannelHandle channel_handle;
+ if (channel.get()) {
+ channel_handle.name = channel->channel_name();
+#if defined(OS_POSIX)
+ // On POSIX, pass the renderer-side FD. Also mark it as auto-close so that
+ // it gets closed after it has been sent.
+ int renderer_fd = channel->DisownRendererFd();
+ channel_handle.socket = base::FileDescriptor(renderer_fd, true);
+#endif
+ }
+
+ Send(new GpuHostMsg_ChannelEstablished(channel_handle));
+}
+
void GpuThread::OnNewRenderWidgetHostView(GpuNativeWindowHandle parent_window,
int32 routing_id) {
// The GPUView class' lifetime is controlled by the host, which will send a