| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 10 #include "content/common/gpu/client/command_buffer_proxy_impl.h" | 10 #include "content/common/gpu/client/command_buffer_proxy_impl.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 #endif | 216 #endif |
| 217 } | 217 } |
| 218 | 218 |
| 219 GpuVideoDecodeAcceleratorHost* GpuChannelHost::CreateVideoDecoder( | 219 GpuVideoDecodeAcceleratorHost* GpuChannelHost::CreateVideoDecoder( |
| 220 int command_buffer_route_id, | 220 int command_buffer_route_id, |
| 221 media::VideoCodecProfile profile, | 221 media::VideoCodecProfile profile, |
| 222 media::VideoDecodeAccelerator::Client* client) { | 222 media::VideoDecodeAccelerator::Client* client) { |
| 223 AutoLock lock(context_lock_); | 223 AutoLock lock(context_lock_); |
| 224 ProxyMap::iterator it = proxies_.find(command_buffer_route_id); | 224 ProxyMap::iterator it = proxies_.find(command_buffer_route_id); |
| 225 DCHECK(it != proxies_.end()); | 225 DCHECK(it != proxies_.end()); |
| 226 CommandBufferProxy* proxy = it->second; | 226 CommandBufferProxyImpl* proxy = it->second; |
| 227 return proxy->CreateVideoDecoder(profile, client); | 227 return proxy->CreateVideoDecoder(profile, client); |
| 228 } | 228 } |
| 229 | 229 |
| 230 CommandBufferProxy* GpuChannelHost::CreateOffscreenCommandBuffer( | 230 CommandBufferProxy* GpuChannelHost::CreateOffscreenCommandBuffer( |
| 231 const gfx::Size& size, | 231 const gfx::Size& size, |
| 232 CommandBufferProxy* share_group, | 232 CommandBufferProxy* share_group, |
| 233 const std::string& allowed_extensions, | 233 const std::string& allowed_extensions, |
| 234 const std::vector<int32>& attribs, | 234 const std::vector<int32>& attribs, |
| 235 const GURL& active_url, | 235 const GURL& active_url, |
| 236 gfx::GpuPreference gpu_preference) { | 236 gfx::GpuPreference gpu_preference) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 260 CommandBufferProxyImpl* command_buffer = | 260 CommandBufferProxyImpl* command_buffer = |
| 261 new CommandBufferProxyImpl(this, route_id); | 261 new CommandBufferProxyImpl(this, route_id); |
| 262 AddRoute(route_id, command_buffer->AsWeakPtr()); | 262 AddRoute(route_id, command_buffer->AsWeakPtr()); |
| 263 proxies_[route_id] = command_buffer; | 263 proxies_[route_id] = command_buffer; |
| 264 return command_buffer; | 264 return command_buffer; |
| 265 #else | 265 #else |
| 266 return NULL; | 266 return NULL; |
| 267 #endif | 267 #endif |
| 268 } | 268 } |
| 269 | 269 |
| 270 void GpuChannelHost::DestroyCommandBuffer(CommandBufferProxy* command_buffer) { | 270 void GpuChannelHost::DestroyCommandBuffer( |
| 271 CommandBufferProxy* command_buffer) { |
| 271 #if defined(ENABLE_GPU) | 272 #if defined(ENABLE_GPU) |
| 272 AutoLock lock(context_lock_); | 273 AutoLock lock(context_lock_); |
| 273 int route_id = command_buffer->GetRouteID(); | 274 int route_id = command_buffer->GetRouteID(); |
| 274 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id)); | 275 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id)); |
| 275 // Check the proxy has not already been removed after a channel error. | 276 // Check the proxy has not already been removed after a channel error. |
| 276 if (proxies_.find(route_id) != proxies_.end()) | 277 if (proxies_.find(route_id) != proxies_.end()) |
| 277 proxies_.erase(route_id); | 278 proxies_.erase(route_id); |
| 278 RemoveRoute(route_id); | 279 RemoveRoute(route_id); |
| 279 delete command_buffer; | 280 delete command_buffer; |
| 280 #endif | 281 #endif |
| (...skipping 25 matching lines...) Expand all Loading... |
| 306 &result))) { | 307 &result))) { |
| 307 return false; | 308 return false; |
| 308 } | 309 } |
| 309 return result; | 310 return result; |
| 310 } | 311 } |
| 311 | 312 |
| 312 void GpuChannelHost::ForciblyCloseChannel() { | 313 void GpuChannelHost::ForciblyCloseChannel() { |
| 313 Send(new GpuChannelMsg_CloseChannel()); | 314 Send(new GpuChannelMsg_CloseChannel()); |
| 314 SetStateLost(); | 315 SetStateLost(); |
| 315 } | 316 } |
| OLD | NEW |