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" | |
17 #include "content/common/gpu/gpu_messages.h" | 16 #include "content/common/gpu/gpu_messages.h" |
18 #include "gpu/command_buffer/common/mailbox.h" | 17 #include "gpu/command_buffer/common/mailbox.h" |
19 #include "ipc/ipc_sync_message_filter.h" | 18 #include "ipc/ipc_sync_message_filter.h" |
20 #include "url/gurl.h" | 19 #include "url/gurl.h" |
21 | 20 |
22 #if defined(OS_WIN) | 21 #if defined(OS_WIN) |
23 #include "content/public/common/sandbox_init.h" | 22 #include "content/public/common/sandbox_init.h" |
24 #endif | 23 #endif |
25 | 24 |
26 using base::AutoLock; | 25 using base::AutoLock; |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 int command_buffer_route_id, | 177 int command_buffer_route_id, |
179 media::VideoCodecProfile profile, | 178 media::VideoCodecProfile profile, |
180 media::VideoDecodeAccelerator::Client* client) { | 179 media::VideoDecodeAccelerator::Client* client) { |
181 AutoLock lock(context_lock_); | 180 AutoLock lock(context_lock_); |
182 ProxyMap::iterator it = proxies_.find(command_buffer_route_id); | 181 ProxyMap::iterator it = proxies_.find(command_buffer_route_id); |
183 DCHECK(it != proxies_.end()); | 182 DCHECK(it != proxies_.end()); |
184 CommandBufferProxyImpl* proxy = it->second; | 183 CommandBufferProxyImpl* proxy = it->second; |
185 return proxy->CreateVideoDecoder(profile, client).Pass(); | 184 return proxy->CreateVideoDecoder(profile, client).Pass(); |
186 } | 185 } |
187 | 186 |
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 | |
203 void GpuChannelHost::DestroyCommandBuffer( | 187 void GpuChannelHost::DestroyCommandBuffer( |
204 CommandBufferProxyImpl* command_buffer) { | 188 CommandBufferProxyImpl* command_buffer) { |
205 TRACE_EVENT0("gpu", "GpuChannelHost::DestroyCommandBuffer"); | 189 TRACE_EVENT0("gpu", "GpuChannelHost::DestroyCommandBuffer"); |
206 | 190 |
207 int route_id = command_buffer->GetRouteID(); | 191 int route_id = command_buffer->GetRouteID(); |
208 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id)); | 192 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id)); |
209 RemoveRoute(route_id); | 193 RemoveRoute(route_id); |
210 | 194 |
211 AutoLock lock(context_lock_); | 195 AutoLock lock(context_lock_); |
212 proxies_.erase(route_id); | 196 proxies_.erase(route_id); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 AutoLock lock(lock_); | 396 AutoLock lock(lock_); |
413 DCHECK_LE(names.size(), requested_mailboxes_); | 397 DCHECK_LE(names.size(), requested_mailboxes_); |
414 requested_mailboxes_ -= names.size(); | 398 requested_mailboxes_ -= names.size(); |
415 mailbox_name_pool_.insert(mailbox_name_pool_.end(), | 399 mailbox_name_pool_.insert(mailbox_name_pool_.end(), |
416 names.begin(), | 400 names.begin(), |
417 names.end()); | 401 names.end()); |
418 } | 402 } |
419 | 403 |
420 | 404 |
421 } // namespace content | 405 } // namespace content |
OLD | NEW |