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

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

Issue 7292010: Delete GpuVideoService and move GpuVideoDecodeAccelerator ownership to stubs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase ToT Created 9 years, 5 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.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) 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/debug/trace_event.h" 12 #include "base/debug/trace_event.h"
13 #include "base/process_util.h" 13 #include "base/process_util.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "content/common/child_process.h" 15 #include "content/common/child_process.h"
16 #include "content/common/content_client.h" 16 #include "content/common/content_client.h"
17 #include "content/common/content_switches.h" 17 #include "content/common/content_switches.h"
18 #include "content/common/gpu/gpu_channel_manager.h" 18 #include "content/common/gpu/gpu_channel_manager.h"
19 #include "content/common/gpu/gpu_messages.h" 19 #include "content/common/gpu/gpu_messages.h"
20 #include "content/common/gpu/media/gpu_video_service.h"
21 #include "content/common/gpu/transport_texture.h" 20 #include "content/common/gpu/transport_texture.h"
22 #include "ui/gfx/gl/gl_context.h" 21 #include "ui/gfx/gl/gl_context.h"
23 #include "ui/gfx/gl/gl_surface.h" 22 #include "ui/gfx/gl/gl_surface.h"
24 23
25 #if defined(OS_POSIX) 24 #if defined(OS_POSIX)
26 #include "ipc/ipc_channel_posix.h" 25 #include "ipc/ipc_channel_posix.h"
27 #endif 26 #endif
28 27
29 GpuChannel::GpuChannel(GpuChannelManager* gpu_channel_manager, 28 GpuChannel::GpuChannel(GpuChannelManager* gpu_channel_manager,
30 GpuWatchdog* watchdog, 29 GpuWatchdog* watchdog,
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 bool handled = true; 229 bool handled = true;
231 IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg) 230 IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg)
232 IPC_MESSAGE_HANDLER(GpuChannelMsg_Initialize, OnInitialize) 231 IPC_MESSAGE_HANDLER(GpuChannelMsg_Initialize, OnInitialize)
233 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateOffscreenCommandBuffer, 232 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateOffscreenCommandBuffer,
234 OnCreateOffscreenCommandBuffer) 233 OnCreateOffscreenCommandBuffer)
235 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyCommandBuffer, 234 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyCommandBuffer,
236 OnDestroyCommandBuffer) 235 OnDestroyCommandBuffer)
237 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateOffscreenSurface, 236 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateOffscreenSurface,
238 OnCreateOffscreenSurface) 237 OnCreateOffscreenSurface)
239 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroySurface, OnDestroySurface) 238 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroySurface, OnDestroySurface)
240 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateVideoDecoder,
241 OnCreateVideoDecoder)
242 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyVideoDecoder,
243 OnDestroyVideoDecoder)
244 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateTransportTexture, 239 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateTransportTexture,
245 OnCreateTransportTexture) 240 OnCreateTransportTexture)
246 IPC_MESSAGE_UNHANDLED(handled = false) 241 IPC_MESSAGE_UNHANDLED(handled = false)
247 IPC_END_MESSAGE_MAP() 242 IPC_END_MESSAGE_MAP()
248 DCHECK(handled) << msg.type(); 243 DCHECK(handled) << msg.type();
249 return handled; 244 return handled;
250 } 245 }
251 246
252 int GpuChannel::GenerateRouteID() { 247 int GpuChannel::GenerateRouteID() {
253 static int last_id = 0; 248 static int last_id = 0;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 323
329 void GpuChannel::OnDestroySurface(int route_id) { 324 void GpuChannel::OnDestroySurface(int route_id) {
330 #if defined(ENABLE_GPU) 325 #if defined(ENABLE_GPU)
331 if (router_.ResolveRoute(route_id)) { 326 if (router_.ResolveRoute(route_id)) {
332 router_.RemoveRoute(route_id); 327 router_.RemoveRoute(route_id);
333 surfaces_.Remove(route_id); 328 surfaces_.Remove(route_id);
334 } 329 }
335 #endif 330 #endif
336 } 331 }
337 332
338 void GpuChannel::OnCreateVideoDecoder(int32 decoder_host_id,
339 uint32 command_buffer_route_id,
340 const std::vector<uint32>& configs) {
341 GpuVideoService* service = GpuVideoService::GetInstance();
342 if (service == NULL) {
343 // TODO(hclam): Need to send a failure message.
344 return;
345 }
346
347 GpuCommandBufferStub* stub = stubs_.Lookup(command_buffer_route_id);
348 // TODO(vrk): Need to notify renderer that given route is invalid.
349 if (!stub)
350 return;
351
352 int32 decoder_id = GenerateRouteID();
353
354 // TODO(fischman): this is a BUG. We hand off stub to be baked into the
355 // resulting GpuVideoDecodeAccelerator, but we don't own that GVDA, and we
356 // make no attempt to tear it down if/when stub is destroyed. GpuVideoService
357 // should be subsumed into this class and GpuVideoDecodeAccelerator should be
358 // owned by GpuCommandBufferStub.
359 bool ret = service->CreateVideoDecoder(
360 this, &router_, decoder_host_id, decoder_id, stub, configs);
361 DCHECK(ret) << "Failed to create a GpuVideoDecodeAccelerator";
362 }
363
364 void GpuChannel::OnDestroyVideoDecoder(int32 decoder_id) {
365 #if defined(ENABLE_GPU)
366 LOG(ERROR) << "GpuChannel::OnDestroyVideoDecoder";
367 GpuVideoService* service = GpuVideoService::GetInstance();
368 if (service == NULL)
369 return;
370 service->DestroyVideoDecoder(&router_, decoder_id);
371 #endif
372 }
373
374 void GpuChannel::OnCreateTransportTexture(int32 context_route_id, 333 void GpuChannel::OnCreateTransportTexture(int32 context_route_id,
375 int32 host_id) { 334 int32 host_id) {
376 #if defined(ENABLE_GPU) 335 #if defined(ENABLE_GPU)
377 GpuCommandBufferStub* stub = stubs_.Lookup(context_route_id); 336 GpuCommandBufferStub* stub = stubs_.Lookup(context_route_id);
378 int32 route_id = GenerateRouteID(); 337 int32 route_id = GenerateRouteID();
379 338
380 scoped_ptr<TransportTexture> transport( 339 scoped_ptr<TransportTexture> transport(
381 new TransportTexture(this, channel_.get(), stub->scheduler()->decoder(), 340 new TransportTexture(this, channel_.get(), stub->scheduler()->decoder(),
382 host_id, route_id)); 341 host_id, route_id));
383 router_.AddRoute(route_id, transport.get()); 342 router_.AddRoute(route_id, transport.get());
(...skipping 30 matching lines...) Expand all
414 373
415 #if defined(OS_POSIX) 374 #if defined(OS_POSIX)
416 int GpuChannel::GetRendererFileDescriptor() { 375 int GpuChannel::GetRendererFileDescriptor() {
417 int fd = -1; 376 int fd = -1;
418 if (channel_.get()) { 377 if (channel_.get()) {
419 fd = channel_->GetClientFileDescriptor(); 378 fd = channel_->GetClientFileDescriptor();
420 } 379 }
421 return fd; 380 return fd;
422 } 381 }
423 #endif // defined(OS_POSIX) 382 #endif // defined(OS_POSIX)
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_channel.h ('k') | content/common/gpu/gpu_command_buffer_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698