| 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/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 } else if (MessageLoop::current()) { | 101 } else if (MessageLoop::current()) { |
| 102 return sync_filter_->Send(message); | 102 return sync_filter_->Send(message); |
| 103 } | 103 } |
| 104 | 104 |
| 105 // Callee takes ownership of message, regardless of whether Send is | 105 // Callee takes ownership of message, regardless of whether Send is |
| 106 // successful. See IPC::Sender. | 106 // successful. See IPC::Sender. |
| 107 delete message; | 107 delete message; |
| 108 return false; | 108 return false; |
| 109 } | 109 } |
| 110 | 110 |
| 111 CommandBufferProxy* GpuChannelHost::CreateViewCommandBuffer( | 111 CommandBufferProxyImpl* GpuChannelHost::CreateViewCommandBuffer( |
| 112 int32 surface_id, | 112 int32 surface_id, |
| 113 CommandBufferProxy* share_group, | 113 CommandBufferProxyImpl* share_group, |
| 114 const std::string& allowed_extensions, | 114 const std::string& allowed_extensions, |
| 115 const std::vector<int32>& attribs, | 115 const std::vector<int32>& attribs, |
| 116 const GURL& active_url, | 116 const GURL& active_url, |
| 117 gfx::GpuPreference gpu_preference) { | 117 gfx::GpuPreference gpu_preference) { |
| 118 TRACE_EVENT1("gpu", | 118 TRACE_EVENT1("gpu", |
| 119 "GpuChannelHost::CreateViewCommandBuffer", | 119 "GpuChannelHost::CreateViewCommandBuffer", |
| 120 "surface_id", | 120 "surface_id", |
| 121 surface_id); | 121 surface_id); |
| 122 | 122 |
| 123 #if defined(ENABLE_GPU) | 123 #if defined(ENABLE_GPU) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 140 CommandBufferProxyImpl* command_buffer = | 140 CommandBufferProxyImpl* command_buffer = |
| 141 new CommandBufferProxyImpl(this, route_id); | 141 new CommandBufferProxyImpl(this, route_id); |
| 142 AddRoute(route_id, command_buffer->AsWeakPtr()); | 142 AddRoute(route_id, command_buffer->AsWeakPtr()); |
| 143 proxies_[route_id] = command_buffer; | 143 proxies_[route_id] = command_buffer; |
| 144 return command_buffer; | 144 return command_buffer; |
| 145 #else | 145 #else |
| 146 return NULL; | 146 return NULL; |
| 147 #endif | 147 #endif |
| 148 } | 148 } |
| 149 | 149 |
| 150 CommandBufferProxy* GpuChannelHost::CreateOffscreenCommandBuffer( | 150 CommandBufferProxyImpl* GpuChannelHost::CreateOffscreenCommandBuffer( |
| 151 const gfx::Size& size, | 151 const gfx::Size& size, |
| 152 CommandBufferProxy* share_group, | 152 CommandBufferProxyImpl* share_group, |
| 153 const std::string& allowed_extensions, | 153 const std::string& allowed_extensions, |
| 154 const std::vector<int32>& attribs, | 154 const std::vector<int32>& attribs, |
| 155 const GURL& active_url, | 155 const GURL& active_url, |
| 156 gfx::GpuPreference gpu_preference) { | 156 gfx::GpuPreference gpu_preference) { |
| 157 TRACE_EVENT0("gpu", "GpuChannelHost::CreateOffscreenCommandBuffer"); | 157 TRACE_EVENT0("gpu", "GpuChannelHost::CreateOffscreenCommandBuffer"); |
| 158 | 158 |
| 159 #if defined(ENABLE_GPU) | 159 #if defined(ENABLE_GPU) |
| 160 AutoLock lock(context_lock_); | 160 AutoLock lock(context_lock_); |
| 161 // An error occurred. Need to get the host again to reinitialize it. | 161 // An error occurred. Need to get the host again to reinitialize it. |
| 162 if (!channel_.get()) | 162 if (!channel_.get()) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 media::VideoCodecProfile profile, | 194 media::VideoCodecProfile profile, |
| 195 media::VideoDecodeAccelerator::Client* client) { | 195 media::VideoDecodeAccelerator::Client* client) { |
| 196 AutoLock lock(context_lock_); | 196 AutoLock lock(context_lock_); |
| 197 ProxyMap::iterator it = proxies_.find(command_buffer_route_id); | 197 ProxyMap::iterator it = proxies_.find(command_buffer_route_id); |
| 198 DCHECK(it != proxies_.end()); | 198 DCHECK(it != proxies_.end()); |
| 199 CommandBufferProxyImpl* proxy = it->second; | 199 CommandBufferProxyImpl* proxy = it->second; |
| 200 return proxy->CreateVideoDecoder(profile, client); | 200 return proxy->CreateVideoDecoder(profile, client); |
| 201 } | 201 } |
| 202 | 202 |
| 203 void GpuChannelHost::DestroyCommandBuffer( | 203 void GpuChannelHost::DestroyCommandBuffer( |
| 204 CommandBufferProxy* command_buffer) { | 204 CommandBufferProxyImpl* command_buffer) { |
| 205 TRACE_EVENT0("gpu", "GpuChannelHost::DestroyCommandBuffer"); | 205 TRACE_EVENT0("gpu", "GpuChannelHost::DestroyCommandBuffer"); |
| 206 | 206 |
| 207 #if defined(ENABLE_GPU) | 207 #if defined(ENABLE_GPU) |
| 208 AutoLock lock(context_lock_); | 208 AutoLock lock(context_lock_); |
| 209 int route_id = command_buffer->GetRouteID(); | 209 int route_id = command_buffer->GetRouteID(); |
| 210 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id)); | 210 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id)); |
| 211 // Check the proxy has not already been removed after a channel error. | 211 // Check the proxy has not already been removed after a channel error. |
| 212 if (proxies_.find(route_id) != proxies_.end()) | 212 if (proxies_.find(route_id) != proxies_.end()) |
| 213 proxies_.erase(route_id); | 213 proxies_.erase(route_id); |
| 214 RemoveRoute(route_id); | 214 RemoveRoute(route_id); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 const GpuListenerInfo& info = it->second; | 311 const GpuListenerInfo& info = it->second; |
| 312 info.loop->PostTask( | 312 info.loop->PostTask( |
| 313 FROM_HERE, | 313 FROM_HERE, |
| 314 base::Bind(&IPC::Listener::OnChannelError, info.listener)); | 314 base::Bind(&IPC::Listener::OnChannelError, info.listener)); |
| 315 } | 315 } |
| 316 | 316 |
| 317 listeners_.clear(); | 317 listeners_.clear(); |
| 318 } | 318 } |
| 319 | 319 |
| 320 } // namespace content | 320 } // namespace content |
| OLD | NEW |