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

Side by Side Diff: content/common/gpu/gpu_channel.cc

Issue 6992010: Added proxy / stub pair for GPU surfaces. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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 | « content/common/gpu/gpu_channel.h ('k') | content/common/gpu/gpu_command_buffer_stub.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #if defined(OS_WIN) 5 #if defined(OS_WIN)
6 #include <windows.h> 6 #include <windows.h>
7 #endif 7 #endif
8 8
9 #include "content/common/gpu/gpu_channel.h" 9 #include "content/common/gpu/gpu_channel.h"
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/process_util.h" 12 #include "base/process_util.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "content/common/child_process.h" 14 #include "content/common/child_process.h"
15 #include "content/common/content_client.h" 15 #include "content/common/content_client.h"
16 #include "content/common/content_switches.h" 16 #include "content/common/content_switches.h"
17 #include "content/common/gpu/gpu_channel_manager.h" 17 #include "content/common/gpu/gpu_channel_manager.h"
18 #include "content/common/gpu/gpu_messages.h" 18 #include "content/common/gpu/gpu_messages.h"
19 #include "content/common/gpu/gpu_video_service.h" 19 #include "content/common/gpu/gpu_video_service.h"
20 #include "content/common/gpu/transport_texture.h" 20 #include "content/common/gpu/transport_texture.h"
21 #include "ui/gfx/gl/gl_surface.h"
21 22
22 #if defined(OS_POSIX) 23 #if defined(OS_POSIX)
23 #include "ipc/ipc_channel_posix.h" 24 #include "ipc/ipc_channel_posix.h"
24 #endif 25 #endif
25 26
26 GpuChannel::GpuChannel(GpuChannelManager* gpu_channel_manager, 27 GpuChannel::GpuChannel(GpuChannelManager* gpu_channel_manager,
27 GpuWatchdog* watchdog, 28 GpuWatchdog* watchdog,
28 int renderer_id) 29 int renderer_id)
29 : gpu_channel_manager_(gpu_channel_manager), 30 : gpu_channel_manager_(gpu_channel_manager),
30 renderer_id_(renderer_id), 31 renderer_id_(renderer_id),
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 #endif 178 #endif
178 179
179 bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) { 180 bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) {
180 bool handled = true; 181 bool handled = true;
181 IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg) 182 IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg)
182 IPC_MESSAGE_HANDLER(GpuChannelMsg_Initialize, OnInitialize) 183 IPC_MESSAGE_HANDLER(GpuChannelMsg_Initialize, OnInitialize)
183 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateOffscreenCommandBuffer, 184 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateOffscreenCommandBuffer,
184 OnCreateOffscreenCommandBuffer) 185 OnCreateOffscreenCommandBuffer)
185 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyCommandBuffer, 186 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyCommandBuffer,
186 OnDestroyCommandBuffer) 187 OnDestroyCommandBuffer)
188 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateOffscreenSurface,
189 OnCreateOffscreenSurface)
190 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroySurface, OnDestroySurface)
187 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateVideoDecoder, 191 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateVideoDecoder,
188 OnCreateVideoDecoder) 192 OnCreateVideoDecoder)
189 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyVideoDecoder, 193 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyVideoDecoder,
190 OnDestroyVideoDecoder) 194 OnDestroyVideoDecoder)
191 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateTransportTexture, 195 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateTransportTexture,
192 OnCreateTransportTexture) 196 OnCreateTransportTexture)
193 IPC_MESSAGE_UNHANDLED(handled = false) 197 IPC_MESSAGE_UNHANDLED(handled = false)
194 IPC_END_MESSAGE_MAP() 198 IPC_END_MESSAGE_MAP()
195 DCHECK(handled); 199 DCHECK(handled);
196 return handled; 200 return handled;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 247
244 void GpuChannel::OnDestroyCommandBuffer(int32 route_id) { 248 void GpuChannel::OnDestroyCommandBuffer(int32 route_id) {
245 #if defined(ENABLE_GPU) 249 #if defined(ENABLE_GPU)
246 if (router_.ResolveRoute(route_id)) { 250 if (router_.ResolveRoute(route_id)) {
247 router_.RemoveRoute(route_id); 251 router_.RemoveRoute(route_id);
248 stubs_.Remove(route_id); 252 stubs_.Remove(route_id);
249 } 253 }
250 #endif 254 #endif
251 } 255 }
252 256
257 void GpuChannel::OnCreateOffscreenSurface(const gfx::Size& size,
258 int* route_id) {
259 *route_id = MSG_ROUTING_NONE;
260
261 #if defined(ENABLE_GPU)
262 scoped_ptr<gfx::GLSurface> surface(
263 gfx::GLSurface::CreateOffscreenGLSurface(size));
264 if (!surface.get())
265 return;
266
267 *route_id = GenerateRouteID();
268
269 scoped_ptr<GpuSurfaceStub> stub (new GpuSurfaceStub(this,
270 *route_id,
271 surface.release()));
272
273 router_.AddRoute(*route_id, stub.get());
274 surfaces_.AddWithID(stub.release(), *route_id);
275 #endif
276 }
277
278 void GpuChannel::OnDestroySurface(int route_id) {
279 #if defined(ENABLE_GPU)
280 if (router_.ResolveRoute(route_id)) {
281 router_.RemoveRoute(route_id);
282 surfaces_.Remove(route_id);
283 }
284 #endif
285 }
286
253 void GpuChannel::OnCreateVideoDecoder( 287 void GpuChannel::OnCreateVideoDecoder(
254 int32 decoder_host_id, const std::vector<uint32>& configs) { 288 int32 decoder_host_id, const std::vector<uint32>& configs) {
255 // TODO(cevans): do NOT re-enable this until GpuVideoService has been checked 289 // TODO(cevans): do NOT re-enable this until GpuVideoService has been checked
256 // for integer overflows, including the classic "width * height" overflow. 290 // for integer overflows, including the classic "width * height" overflow.
257 #if 0 291 #if 0
258 VLOG(1) << "GpuChannel::OnCreateVideoDecoder"; 292 VLOG(1) << "GpuChannel::OnCreateVideoDecoder";
259 GpuVideoService* service = GpuVideoService::GetInstance(); 293 GpuVideoService* service = GpuVideoService::GetInstance();
260 if (service == NULL) { 294 if (service == NULL) {
261 // TODO(hclam): Need to send a failure message. 295 // TODO(hclam): Need to send a failure message.
262 return; 296 return;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 357
324 #if defined(OS_POSIX) 358 #if defined(OS_POSIX)
325 int GpuChannel::GetRendererFileDescriptor() { 359 int GpuChannel::GetRendererFileDescriptor() {
326 int fd = -1; 360 int fd = -1;
327 if (channel_.get()) { 361 if (channel_.get()) {
328 fd = channel_->GetClientFileDescriptor(); 362 fd = channel_->GetClientFileDescriptor();
329 } 363 }
330 return fd; 364 return fd;
331 } 365 }
332 #endif // defined(OS_POSIX) 366 #endif // defined(OS_POSIX)
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_channel.h ('k') | content/common/gpu/gpu_command_buffer_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698