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/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
12 #include "base/posix/eintr_wrapper.h" | 12 #include "base/posix/eintr_wrapper.h" |
13 #include "base/threading/thread_restrictions.h" | 13 #include "base/threading/thread_restrictions.h" |
14 #include "base/trace_event/trace_event.h" | 14 #include "base/trace_event/trace_event.h" |
15 #include "content/common/gpu/client/command_buffer_proxy_impl.h" | 15 #include "content/common/gpu/client/command_buffer_proxy_impl.h" |
| 16 #include "content/common/gpu/client/gpu_jpeg_decode_accelerator_host.h" |
16 #include "content/common/gpu/gpu_messages.h" | 17 #include "content/common/gpu/gpu_messages.h" |
17 #include "ipc/ipc_sync_message_filter.h" | 18 #include "ipc/ipc_sync_message_filter.h" |
18 #include "url/gurl.h" | 19 #include "url/gurl.h" |
19 | 20 |
20 #if defined(OS_WIN) | 21 #if defined(OS_WIN) |
21 #include "content/public/common/sandbox_init.h" | 22 #include "content/public/common/sandbox_init.h" |
22 #endif | 23 #endif |
23 | 24 |
24 using base::AutoLock; | 25 using base::AutoLock; |
25 using base::MessageLoopProxy; | 26 using base::MessageLoopProxy; |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 257 |
257 scoped_ptr<media::VideoEncodeAccelerator> GpuChannelHost::CreateVideoEncoder( | 258 scoped_ptr<media::VideoEncodeAccelerator> GpuChannelHost::CreateVideoEncoder( |
258 int command_buffer_route_id) { | 259 int command_buffer_route_id) { |
259 TRACE_EVENT0("gpu", "GpuChannelHost::CreateVideoEncoder"); | 260 TRACE_EVENT0("gpu", "GpuChannelHost::CreateVideoEncoder"); |
260 AutoLock lock(context_lock_); | 261 AutoLock lock(context_lock_); |
261 ProxyMap::iterator it = proxies_.find(command_buffer_route_id); | 262 ProxyMap::iterator it = proxies_.find(command_buffer_route_id); |
262 DCHECK(it != proxies_.end()); | 263 DCHECK(it != proxies_.end()); |
263 return it->second->CreateVideoEncoder(); | 264 return it->second->CreateVideoEncoder(); |
264 } | 265 } |
265 | 266 |
| 267 scoped_ptr<media::JpegDecodeAccelerator> GpuChannelHost::CreateJpegDecoder() { |
| 268 TRACE_EVENT0("gpu", "GpuChannelHost::CreateJpegDecoder"); |
| 269 |
| 270 int32 route_id = GenerateRouteID(); |
| 271 GpuJpegDecodeAcceleratorHost* decoder( |
| 272 new GpuJpegDecodeAcceleratorHost(this, route_id)); |
| 273 AddRoute(route_id, decoder->AsWeakPtr()); |
| 274 |
| 275 return scoped_ptr<media::JpegDecodeAccelerator>(decoder); |
| 276 } |
| 277 |
266 void GpuChannelHost::DestroyCommandBuffer( | 278 void GpuChannelHost::DestroyCommandBuffer( |
267 CommandBufferProxyImpl* command_buffer) { | 279 CommandBufferProxyImpl* command_buffer) { |
268 TRACE_EVENT0("gpu", "GpuChannelHost::DestroyCommandBuffer"); | 280 TRACE_EVENT0("gpu", "GpuChannelHost::DestroyCommandBuffer"); |
269 | 281 |
270 int route_id = command_buffer->GetRouteID(); | 282 int route_id = command_buffer->GetRouteID(); |
271 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id)); | 283 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id)); |
272 RemoveRoute(route_id); | 284 RemoveRoute(route_id); |
273 | 285 |
274 AutoLock lock(context_lock_); | 286 AutoLock lock(context_lock_); |
275 proxies_.erase(route_id); | 287 proxies_.erase(route_id); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 | 455 |
444 listeners_.clear(); | 456 listeners_.clear(); |
445 } | 457 } |
446 | 458 |
447 bool GpuChannelHost::MessageFilter::IsLost() const { | 459 bool GpuChannelHost::MessageFilter::IsLost() const { |
448 AutoLock lock(lock_); | 460 AutoLock lock(lock_); |
449 return lost_; | 461 return lost_; |
450 } | 462 } |
451 | 463 |
452 } // namespace content | 464 } // namespace content |
OLD | NEW |