| OLD | NEW |
| 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 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateVideoDecoder, | 205 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateVideoDecoder, |
| 206 OnCreateVideoDecoder) | 206 OnCreateVideoDecoder) |
| 207 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyVideoDecoder, | 207 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyVideoDecoder, |
| 208 OnDestroyVideoDecoder) | 208 OnDestroyVideoDecoder) |
| 209 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateTransportTexture, | 209 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateTransportTexture, |
| 210 OnCreateTransportTexture) | 210 OnCreateTransportTexture) |
| 211 IPC_MESSAGE_HANDLER(GpuChannelMsg_AssignTexturesToVideoDecoder, | 211 IPC_MESSAGE_HANDLER(GpuChannelMsg_AssignTexturesToVideoDecoder, |
| 212 OnAssignTexturesToVideoDecoder) | 212 OnAssignTexturesToVideoDecoder) |
| 213 IPC_MESSAGE_UNHANDLED(handled = false) | 213 IPC_MESSAGE_UNHANDLED(handled = false) |
| 214 IPC_END_MESSAGE_MAP() | 214 IPC_END_MESSAGE_MAP() |
| 215 DCHECK(handled); | 215 DCHECK(handled) << msg.type(); |
| 216 return handled; | 216 return handled; |
| 217 } | 217 } |
| 218 | 218 |
| 219 int GpuChannel::GenerateRouteID() { | 219 int GpuChannel::GenerateRouteID() { |
| 220 static int last_id = 0; | 220 static int last_id = 0; |
| 221 return ++last_id; | 221 return ++last_id; |
| 222 } | 222 } |
| 223 | 223 |
| 224 void GpuChannel::OnInitialize(base::ProcessHandle renderer_process) { | 224 void GpuChannel::OnInitialize(base::ProcessHandle renderer_process) { |
| 225 // Initialize should only happen once. | 225 // Initialize should only happen once. |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 return; | 318 return; |
| 319 } | 319 } |
| 320 | 320 |
| 321 GpuCommandBufferStub* stub = stubs_.Lookup(command_buffer_route_id); | 321 GpuCommandBufferStub* stub = stubs_.Lookup(command_buffer_route_id); |
| 322 // TODO(vrk): Need to notify renderer that given route is invalid. | 322 // TODO(vrk): Need to notify renderer that given route is invalid. |
| 323 if (!stub) | 323 if (!stub) |
| 324 return; | 324 return; |
| 325 | 325 |
| 326 int32 decoder_id = GenerateRouteID(); | 326 int32 decoder_id = GenerateRouteID(); |
| 327 | 327 |
| 328 // TODO(fischman): this is a BUG. We hand off stub->scheduler()->decoder() |
| 329 // to be baked into the resulting GpuVideoDecodeAccelerator, but we don't own |
| 330 // that GVDA, and we make no attempt to tear it down if/when |
| 331 // stub->scheduler()->decoder() is destroyed. GpuVideoService should be |
| 332 // subsumed into this class and GpuVideoDecodeAccelerator should be owned by |
| 333 // the GpuCommandBufferStub that owns the commandbuffer GVDA is using. |
| 328 bool ret = service->CreateVideoDecoder( | 334 bool ret = service->CreateVideoDecoder( |
| 329 this, &router_, decoder_host_id, decoder_id, stub->scheduler()->decoder(), | 335 this, &router_, decoder_host_id, decoder_id, stub->scheduler()->decoder(), |
| 330 configs); | 336 configs); |
| 331 DCHECK(ret) << "Failed to create a GpuVideoDecodeAccelerator"; | 337 DCHECK(ret) << "Failed to create a GpuVideoDecodeAccelerator"; |
| 332 } | 338 } |
| 333 | 339 |
| 334 void GpuChannel::OnDestroyVideoDecoder(int32 decoder_id) { | 340 void GpuChannel::OnDestroyVideoDecoder(int32 decoder_id) { |
| 335 #if defined(ENABLE_GPU) | 341 #if defined(ENABLE_GPU) |
| 336 LOG(ERROR) << "GpuChannel::OnDestroyVideoDecoder"; | 342 LOG(ERROR) << "GpuChannel::OnDestroyVideoDecoder"; |
| 337 GpuVideoService* service = GpuVideoService::GetInstance(); | 343 GpuVideoService* service = GpuVideoService::GetInstance(); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 | 399 |
| 394 #if defined(OS_POSIX) | 400 #if defined(OS_POSIX) |
| 395 int GpuChannel::GetRendererFileDescriptor() { | 401 int GpuChannel::GetRendererFileDescriptor() { |
| 396 int fd = -1; | 402 int fd = -1; |
| 397 if (channel_.get()) { | 403 if (channel_.get()) { |
| 398 fd = channel_->GetClientFileDescriptor(); | 404 fd = channel_->GetClientFileDescriptor(); |
| 399 } | 405 } |
| 400 return fd; | 406 return fd; |
| 401 } | 407 } |
| 402 #endif // defined(OS_POSIX) | 408 #endif // defined(OS_POSIX) |
| OLD | NEW |