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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
12 #include "base/message_loop/message_loop_proxy.h" | 12 #include "base/message_loop/message_loop_proxy.h" |
13 #include "base/posix/eintr_wrapper.h" | 13 #include "base/posix/eintr_wrapper.h" |
14 #include "base/threading/thread_restrictions.h" | 14 #include "base/threading/thread_restrictions.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_video_encode_accelerator_host.h" |
16 #include "content/common/gpu/gpu_messages.h" | 17 #include "content/common/gpu/gpu_messages.h" |
17 #include "gpu/command_buffer/common/mailbox.h" | 18 #include "gpu/command_buffer/common/mailbox.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; |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 int command_buffer_route_id, | 178 int command_buffer_route_id, |
178 media::VideoCodecProfile profile, | 179 media::VideoCodecProfile profile, |
179 media::VideoDecodeAccelerator::Client* client) { | 180 media::VideoDecodeAccelerator::Client* client) { |
180 AutoLock lock(context_lock_); | 181 AutoLock lock(context_lock_); |
181 ProxyMap::iterator it = proxies_.find(command_buffer_route_id); | 182 ProxyMap::iterator it = proxies_.find(command_buffer_route_id); |
182 DCHECK(it != proxies_.end()); | 183 DCHECK(it != proxies_.end()); |
183 CommandBufferProxyImpl* proxy = it->second; | 184 CommandBufferProxyImpl* proxy = it->second; |
184 return proxy->CreateVideoDecoder(profile, client).Pass(); | 185 return proxy->CreateVideoDecoder(profile, client).Pass(); |
185 } | 186 } |
186 | 187 |
| 188 scoped_ptr<media::VideoEncodeAccelerator> GpuChannelHost::CreateVideoEncoder( |
| 189 media::VideoEncodeAccelerator::Client* client) { |
| 190 TRACE_EVENT0("gpu", "GpuChannelHost::CreateVideoEncoder"); |
| 191 |
| 192 scoped_ptr<media::VideoEncodeAccelerator> vea; |
| 193 int32 route_id = MSG_ROUTING_NONE; |
| 194 if (!Send(new GpuChannelMsg_CreateVideoEncoder(&route_id))) |
| 195 return vea.Pass(); |
| 196 if (route_id == MSG_ROUTING_NONE) |
| 197 return vea.Pass(); |
| 198 |
| 199 vea.reset(new GpuVideoEncodeAcceleratorHost(client, this, route_id)); |
| 200 return vea.Pass(); |
| 201 } |
| 202 |
187 void GpuChannelHost::DestroyCommandBuffer( | 203 void GpuChannelHost::DestroyCommandBuffer( |
188 CommandBufferProxyImpl* command_buffer) { | 204 CommandBufferProxyImpl* command_buffer) { |
189 TRACE_EVENT0("gpu", "GpuChannelHost::DestroyCommandBuffer"); | 205 TRACE_EVENT0("gpu", "GpuChannelHost::DestroyCommandBuffer"); |
190 | 206 |
191 int route_id = command_buffer->GetRouteID(); | 207 int route_id = command_buffer->GetRouteID(); |
192 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id)); | 208 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id)); |
193 RemoveRoute(route_id); | 209 RemoveRoute(route_id); |
194 | 210 |
195 AutoLock lock(context_lock_); | 211 AutoLock lock(context_lock_); |
196 proxies_.erase(route_id); | 212 proxies_.erase(route_id); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 AutoLock lock(lock_); | 412 AutoLock lock(lock_); |
397 DCHECK_LE(names.size(), requested_mailboxes_); | 413 DCHECK_LE(names.size(), requested_mailboxes_); |
398 requested_mailboxes_ -= names.size(); | 414 requested_mailboxes_ -= names.size(); |
399 mailbox_name_pool_.insert(mailbox_name_pool_.end(), | 415 mailbox_name_pool_.insert(mailbox_name_pool_.end(), |
400 names.begin(), | 416 names.begin(), |
401 names.end()); | 417 names.end()); |
402 } | 418 } |
403 | 419 |
404 | 420 |
405 } // namespace content | 421 } // namespace content |
OLD | NEW |