| 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; |
| 194 if (!Send(new GpuChannelMsg_CreateVideoEncoder(&route_id))) { |
| 195 return vea.Pass(); |
| 196 } |
| 197 if (route_id == MSG_ROUTING_NONE) |
| 198 return vea.Pass(); |
| 199 |
| 200 vea.reset(new GpuVideoEncodeAcceleratorHost(client, this, route_id)); |
| 201 return vea.Pass(); |
| 202 } |
| 203 |
| 187 void GpuChannelHost::DestroyCommandBuffer( | 204 void GpuChannelHost::DestroyCommandBuffer( |
| 188 CommandBufferProxyImpl* command_buffer) { | 205 CommandBufferProxyImpl* command_buffer) { |
| 189 TRACE_EVENT0("gpu", "GpuChannelHost::DestroyCommandBuffer"); | 206 TRACE_EVENT0("gpu", "GpuChannelHost::DestroyCommandBuffer"); |
| 190 | 207 |
| 191 int route_id = command_buffer->GetRouteID(); | 208 int route_id = command_buffer->GetRouteID(); |
| 192 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id)); | 209 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id)); |
| 193 RemoveRoute(route_id); | 210 RemoveRoute(route_id); |
| 194 | 211 |
| 195 AutoLock lock(context_lock_); | 212 AutoLock lock(context_lock_); |
| 196 proxies_.erase(route_id); | 213 proxies_.erase(route_id); |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 AutoLock lock(lock_); | 413 AutoLock lock(lock_); |
| 397 DCHECK_LE(names.size(), requested_mailboxes_); | 414 DCHECK_LE(names.size(), requested_mailboxes_); |
| 398 requested_mailboxes_ -= names.size(); | 415 requested_mailboxes_ -= names.size(); |
| 399 mailbox_name_pool_.insert(mailbox_name_pool_.end(), | 416 mailbox_name_pool_.insert(mailbox_name_pool_.end(), |
| 400 names.begin(), | 417 names.begin(), |
| 401 names.end()); | 418 names.end()); |
| 402 } | 419 } |
| 403 | 420 |
| 404 | 421 |
| 405 } // namespace content | 422 } // namespace content |
| OLD | NEW |