OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/common/gpu/client/gpu_channel_host.h" | 5 #include "content/common/gpu/client/gpu_channel_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/posix/eintr_wrapper.h" | 11 #include "base/posix/eintr_wrapper.h" |
12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
13 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
14 #include "base/threading/thread_restrictions.h" | 14 #include "base/threading/thread_restrictions.h" |
15 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
16 #include "content/common/gpu/client/command_buffer_proxy_impl.h" | 16 #include "content/common/gpu/client/command_buffer_proxy_impl.h" |
| 17 #include "content/common/gpu/client/gpu_jpeg_decode_accelerator_host.h" |
17 #include "content/common/gpu/gpu_messages.h" | 18 #include "content/common/gpu/gpu_messages.h" |
18 #include "ipc/ipc_sync_message_filter.h" | 19 #include "ipc/ipc_sync_message_filter.h" |
19 #include "url/gurl.h" | 20 #include "url/gurl.h" |
20 | 21 |
21 #if defined(OS_WIN) | 22 #if defined(OS_WIN) |
22 #include "content/public/common/sandbox_init.h" | 23 #include "content/public/common/sandbox_init.h" |
23 #endif | 24 #endif |
24 | 25 |
25 using base::AutoLock; | 26 using base::AutoLock; |
26 | 27 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 252 |
252 scoped_ptr<media::VideoEncodeAccelerator> GpuChannelHost::CreateVideoEncoder( | 253 scoped_ptr<media::VideoEncodeAccelerator> GpuChannelHost::CreateVideoEncoder( |
253 int command_buffer_route_id) { | 254 int command_buffer_route_id) { |
254 TRACE_EVENT0("gpu", "GpuChannelHost::CreateVideoEncoder"); | 255 TRACE_EVENT0("gpu", "GpuChannelHost::CreateVideoEncoder"); |
255 AutoLock lock(context_lock_); | 256 AutoLock lock(context_lock_); |
256 ProxyMap::iterator it = proxies_.find(command_buffer_route_id); | 257 ProxyMap::iterator it = proxies_.find(command_buffer_route_id); |
257 DCHECK(it != proxies_.end()); | 258 DCHECK(it != proxies_.end()); |
258 return it->second->CreateVideoEncoder(); | 259 return it->second->CreateVideoEncoder(); |
259 } | 260 } |
260 | 261 |
| 262 scoped_ptr<media::JpegDecodeAccelerator> GpuChannelHost::CreateJpegDecoder() { |
| 263 TRACE_EVENT0("gpu", "GpuChannelHost::CreateJpegDecoder"); |
| 264 |
| 265 int32 route_id = GenerateRouteID(); |
| 266 GpuJpegDecodeAcceleratorHost* decoder( |
| 267 new GpuJpegDecodeAcceleratorHost(this, route_id)); |
| 268 AddRoute(route_id, decoder->AsWeakPtr()); |
| 269 |
| 270 return scoped_ptr<media::JpegDecodeAccelerator>(decoder); |
| 271 } |
| 272 |
261 void GpuChannelHost::DestroyCommandBuffer( | 273 void GpuChannelHost::DestroyCommandBuffer( |
262 CommandBufferProxyImpl* command_buffer) { | 274 CommandBufferProxyImpl* command_buffer) { |
263 TRACE_EVENT0("gpu", "GpuChannelHost::DestroyCommandBuffer"); | 275 TRACE_EVENT0("gpu", "GpuChannelHost::DestroyCommandBuffer"); |
264 | 276 |
265 int route_id = command_buffer->GetRouteID(); | 277 int route_id = command_buffer->GetRouteID(); |
266 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id)); | 278 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id)); |
267 RemoveRoute(route_id); | 279 RemoveRoute(route_id); |
268 | 280 |
269 AutoLock lock(context_lock_); | 281 AutoLock lock(context_lock_); |
270 proxies_.erase(route_id); | 282 proxies_.erase(route_id); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 | 448 |
437 listeners_.clear(); | 449 listeners_.clear(); |
438 } | 450 } |
439 | 451 |
440 bool GpuChannelHost::MessageFilter::IsLost() const { | 452 bool GpuChannelHost::MessageFilter::IsLost() const { |
441 AutoLock lock(lock_); | 453 AutoLock lock(lock_); |
442 return lost_; | 454 return lost_; |
443 } | 455 } |
444 | 456 |
445 } // namespace content | 457 } // namespace content |
OLD | NEW |