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

Side by Side Diff: chrome/gpu/gpu_thread.cc

Issue 1136006: Calling OpenGL from the renderer process. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/gpu/gpu_thread.h ('k') | chrome/plugin/command_buffer_stub.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/gpu/gpu_thread.h" 5 #include "chrome/gpu/gpu_thread.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "chrome/common/child_process.h" 8 #include "chrome/common/child_process.h"
9 #include "chrome/common/gpu_messages.h" 9 #include "chrome/common/gpu_messages.h"
10 #include "chrome/gpu/gpu_channel.h"
11 #include "chrome/gpu/gpu_config.h" 10 #include "chrome/gpu/gpu_config.h"
12 11
13 #if defined(OS_WIN) 12 #if defined(OS_WIN)
14 #include "chrome/gpu/gpu_view_win.h" 13 #include "chrome/gpu/gpu_view_win.h"
15 #elif defined(GPU_USE_GLX) 14 #elif defined(GPU_USE_GLX)
16 #include "chrome/gpu/gpu_backing_store_glx_context.h" 15 #include "chrome/gpu/gpu_backing_store_glx_context.h"
17 #include "chrome/gpu/gpu_view_x.h" 16 #include "chrome/gpu/gpu_view_x.h"
18 17
19 #include <X11/Xutil.h> // Must be last. 18 #include <X11/Xutil.h> // Must be last.
20 #endif 19 #endif
(...skipping 19 matching lines...) Expand all
40 bool msg_is_ok = true; 39 bool msg_is_ok = true;
41 IPC_BEGIN_MESSAGE_MAP_EX(GpuThread, msg, msg_is_ok) 40 IPC_BEGIN_MESSAGE_MAP_EX(GpuThread, msg, msg_is_ok)
42 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, 41 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel,
43 OnEstablishChannel) 42 OnEstablishChannel)
44 IPC_MESSAGE_HANDLER(GpuMsg_NewRenderWidgetHostView, 43 IPC_MESSAGE_HANDLER(GpuMsg_NewRenderWidgetHostView,
45 OnNewRenderWidgetHostView) 44 OnNewRenderWidgetHostView)
46 IPC_END_MESSAGE_MAP_EX() 45 IPC_END_MESSAGE_MAP_EX()
47 } 46 }
48 47
49 void GpuThread::OnEstablishChannel(int renderer_id) { 48 void GpuThread::OnEstablishChannel(int renderer_id) {
50 scoped_refptr<GpuChannel> channel = 49 scoped_refptr<GpuChannel> channel;
51 GpuChannel::EstablishGpuChannel(renderer_id); 50
51 GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id);
52 if (iter == gpu_channels_.end()) {
53 channel = new GpuChannel(renderer_id);
54 } else {
55 channel = iter->second;
56 }
57
58 DCHECK(channel != NULL);
59
60 if (channel->Init()) {
61 // TODO(apatrick): figure out when to remove channels from the map. They
62 // will never be destroyed otherwise.
63 gpu_channels_[renderer_id] = channel;
64 } else {
65 channel = NULL;
66 }
67
52 IPC::ChannelHandle channel_handle; 68 IPC::ChannelHandle channel_handle;
53 if (channel.get()) { 69 if (channel.get()) {
54 channel_handle.name = channel->channel_name(); 70 channel_handle.name = channel->GetChannelName();
55 #if defined(OS_POSIX) 71 #if defined(OS_POSIX)
56 // On POSIX, pass the renderer-side FD. Also mark it as auto-close so that 72 // On POSIX, pass the renderer-side FD. Also mark it as auto-close so that
57 // it gets closed after it has been sent. 73 // it gets closed after it has been sent.
58 int renderer_fd = channel->DisownRendererFd(); 74 int renderer_fd = channel->DisownRendererFd();
59 channel_handle.socket = base::FileDescriptor(renderer_fd, true); 75 channel_handle.socket = base::FileDescriptor(renderer_fd, true);
60 #endif 76 #endif
61 } 77 }
62 78
63 Send(new GpuHostMsg_ChannelEstablished(channel_handle)); 79 Send(new GpuHostMsg_ChannelEstablished(channel_handle));
64 } 80 }
65 81
66 void GpuThread::OnNewRenderWidgetHostView(GpuNativeWindowHandle parent_window, 82 void GpuThread::OnNewRenderWidgetHostView(GpuNativeWindowHandle parent_window,
67 int32 routing_id) { 83 int32 routing_id) {
68 // The GPUView class' lifetime is controlled by the host, which will send a 84 // The GPUView class' lifetime is controlled by the host, which will send a
69 // message to destroy the GpuRWHView when necessary. So we don't manage the 85 // message to destroy the GpuRWHView when necessary. So we don't manage the
70 // lifetime of this object. 86 // lifetime of this object.
71 #if defined(OS_WIN) 87 #if defined(OS_WIN)
72 new GpuViewWin(this, parent_window, routing_id); 88 new GpuViewWin(this, parent_window, routing_id);
73 #elif defined(GPU_USE_GLX) 89 #elif defined(GPU_USE_GLX)
74 new GpuViewX(this, parent_window, routing_id); 90 new GpuViewX(this, parent_window, routing_id);
75 #else 91 #else
76 NOTIMPLEMENTED(); 92 NOTIMPLEMENTED();
77 #endif 93 #endif
78 } 94 }
OLDNEW
« no previous file with comments | « chrome/gpu/gpu_thread.h ('k') | chrome/plugin/command_buffer_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698