Chromium Code Reviews| 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 | 250 |
| 250 scoped_ptr<media::VideoEncodeAccelerator> GpuChannelHost::CreateVideoEncoder( | 251 scoped_ptr<media::VideoEncodeAccelerator> GpuChannelHost::CreateVideoEncoder( |
| 251 int command_buffer_route_id) { | 252 int command_buffer_route_id) { |
| 252 TRACE_EVENT0("gpu", "GpuChannelHost::CreateVideoEncoder"); | 253 TRACE_EVENT0("gpu", "GpuChannelHost::CreateVideoEncoder"); |
| 253 AutoLock lock(context_lock_); | 254 AutoLock lock(context_lock_); |
| 254 ProxyMap::iterator it = proxies_.find(command_buffer_route_id); | 255 ProxyMap::iterator it = proxies_.find(command_buffer_route_id); |
| 255 DCHECK(it != proxies_.end()); | 256 DCHECK(it != proxies_.end()); |
| 256 return it->second->CreateVideoEncoder(); | 257 return it->second->CreateVideoEncoder(); |
| 257 } | 258 } |
| 258 | 259 |
| 260 scoped_ptr<media::JpegDecodeAccelerator> GpuChannelHost::CreateJpegDecoder() { | |
|
wuchengli
2015/04/15 07:11:57
It looks OK to run CreateJpegDecoder on non-main t
kcwu
2015/04/16 14:38:27
Acknowledged.
| |
| 261 TRACE_EVENT0("gpu", "GpuChannelHost::CreateJpegDecoder"); | |
| 262 | |
| 263 int32 route_id = GenerateRouteID(); | |
| 264 GpuJpegDecodeAcceleratorHost* decoder( | |
| 265 new GpuJpegDecodeAcceleratorHost(this, route_id)); | |
| 266 | |
| 267 scoped_refptr<base::MessageLoopProxy> io_loop = factory_->GetIOLoopProxy(); | |
|
wuchengli
2015/04/15 07:11:57
Add a comment to explain we want to run VideoFrame
kcwu
2015/04/16 14:38:27
Done.
| |
| 268 io_loop->PostTask(FROM_HERE, | |
| 269 base::Bind(&GpuChannelHost::MessageFilter::AddRoute, | |
| 270 channel_filter_.get(), route_id, | |
| 271 decoder->AsWeakPtr(), io_loop)); | |
| 272 return scoped_ptr<media::JpegDecodeAccelerator>(decoder); | |
| 273 } | |
| 274 | |
| 259 void GpuChannelHost::DestroyCommandBuffer( | 275 void GpuChannelHost::DestroyCommandBuffer( |
| 260 CommandBufferProxyImpl* command_buffer) { | 276 CommandBufferProxyImpl* command_buffer) { |
| 261 TRACE_EVENT0("gpu", "GpuChannelHost::DestroyCommandBuffer"); | 277 TRACE_EVENT0("gpu", "GpuChannelHost::DestroyCommandBuffer"); |
| 262 | 278 |
| 263 int route_id = command_buffer->GetRouteID(); | 279 int route_id = command_buffer->GetRouteID(); |
| 264 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id)); | 280 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id)); |
| 265 RemoveRoute(route_id); | 281 RemoveRoute(route_id); |
| 266 | 282 |
| 267 AutoLock lock(context_lock_); | 283 AutoLock lock(context_lock_); |
| 268 proxies_.erase(route_id); | 284 proxies_.erase(route_id); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 426 | 442 |
| 427 listeners_.clear(); | 443 listeners_.clear(); |
| 428 } | 444 } |
| 429 | 445 |
| 430 bool GpuChannelHost::MessageFilter::IsLost() const { | 446 bool GpuChannelHost::MessageFilter::IsLost() const { |
| 431 AutoLock lock(lock_); | 447 AutoLock lock(lock_); |
| 432 return lost_; | 448 return lost_; |
| 433 } | 449 } |
| 434 | 450 |
| 435 } // namespace content | 451 } // namespace content |
| OLD | NEW |