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 media::JpegDecodeAccelerator::Client* client) { |
| 264 TRACE_EVENT0("gpu", "GpuChannelHost::CreateJpegDecoder"); |
| 265 |
| 266 int32 route_id = GenerateRouteID(); |
| 267 scoped_ptr<GpuJpegDecodeAcceleratorHost> decoder( |
| 268 new GpuJpegDecodeAcceleratorHost(this, route_id)); |
| 269 if (!decoder->Initialize(client)) { |
| 270 return nullptr; |
| 271 } |
| 272 AddRoute(route_id, decoder->AsWeakPtr()); |
| 273 |
| 274 return decoder.Pass(); |
| 275 } |
| 276 |
261 void GpuChannelHost::DestroyCommandBuffer( | 277 void GpuChannelHost::DestroyCommandBuffer( |
262 CommandBufferProxyImpl* command_buffer) { | 278 CommandBufferProxyImpl* command_buffer) { |
263 TRACE_EVENT0("gpu", "GpuChannelHost::DestroyCommandBuffer"); | 279 TRACE_EVENT0("gpu", "GpuChannelHost::DestroyCommandBuffer"); |
264 | 280 |
265 int route_id = command_buffer->GetRouteID(); | 281 int route_id = command_buffer->GetRouteID(); |
266 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id)); | 282 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id)); |
267 RemoveRoute(route_id); | 283 RemoveRoute(route_id); |
268 | 284 |
269 AutoLock lock(context_lock_); | 285 AutoLock lock(context_lock_); |
270 proxies_.erase(route_id); | 286 proxies_.erase(route_id); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 | 452 |
437 listeners_.clear(); | 453 listeners_.clear(); |
438 } | 454 } |
439 | 455 |
440 bool GpuChannelHost::MessageFilter::IsLost() const { | 456 bool GpuChannelHost::MessageFilter::IsLost() const { |
441 AutoLock lock(lock_); | 457 AutoLock lock(lock_); |
442 return lost_; | 458 return lost_; |
443 } | 459 } |
444 | 460 |
445 } // namespace content | 461 } // namespace content |
OLD | NEW |