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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
207 int route_id = command_buffer->GetRouteID(); | 207 int route_id = command_buffer->GetRouteID(); |
208 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id)); | 208 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id)); |
209 // Check the proxy has not already been removed after a channel error. | 209 // Check the proxy has not already been removed after a channel error. |
210 if (proxies_.find(route_id) != proxies_.end()) | 210 if (proxies_.find(route_id) != proxies_.end()) |
211 proxies_.erase(route_id); | 211 proxies_.erase(route_id); |
212 RemoveRoute(route_id); | 212 RemoveRoute(route_id); |
213 delete command_buffer; | 213 delete command_buffer; |
214 #endif | 214 #endif |
215 } | 215 } |
216 | 216 |
217 bool GpuChannelHost::CollectRenderingStats( | |
218 int surface_id, content::GpuRenderingStats& stats) { | |
219 TRACE_EVENT0("gpu", "GpuChannelHost::CollectRenderingStats"); | |
220 | |
221 #if defined(ENABLE_GPU) | |
222 AutoLock lock(context_lock_); | |
223 // An error occurred. Need to get the host again to reinitialize it. | |
224 if (!channel_.get()) | |
225 return false; | |
226 | |
227 if (!Send(new GpuChannelMsg_CollectRenderingStats(surface_id, &stats))) { | |
apatrick_chromium
2012/08/28 20:07:06
No need for braces here.
| |
228 return false; | |
229 } | |
230 | |
231 return true; | |
232 #else | |
233 return false; | |
234 #endif | |
235 } | |
236 | |
217 void GpuChannelHost::AddRoute( | 237 void GpuChannelHost::AddRoute( |
218 int route_id, base::WeakPtr<IPC::Listener> listener) { | 238 int route_id, base::WeakPtr<IPC::Listener> listener) { |
219 DCHECK(MessageLoopProxy::current()); | 239 DCHECK(MessageLoopProxy::current()); |
220 | 240 |
221 scoped_refptr<base::MessageLoopProxy> io_loop = factory_->GetIOLoopProxy(); | 241 scoped_refptr<base::MessageLoopProxy> io_loop = factory_->GetIOLoopProxy(); |
222 io_loop->PostTask(FROM_HERE, | 242 io_loop->PostTask(FROM_HERE, |
223 base::Bind(&GpuChannelHost::MessageFilter::AddRoute, | 243 base::Bind(&GpuChannelHost::MessageFilter::AddRoute, |
224 channel_filter_.get(), route_id, listener, | 244 channel_filter_.get(), route_id, listener, |
225 MessageLoopProxy::current())); | 245 MessageLoopProxy::current())); |
226 } | 246 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
301 const GpuListenerInfo& info = it->second; | 321 const GpuListenerInfo& info = it->second; |
302 info.loop->PostTask( | 322 info.loop->PostTask( |
303 FROM_HERE, | 323 FROM_HERE, |
304 base::Bind(&IPC::Listener::OnChannelError, info.listener)); | 324 base::Bind(&IPC::Listener::OnChannelError, info.listener)); |
305 } | 325 } |
306 | 326 |
307 listeners_.clear(); | 327 listeners_.clear(); |
308 } | 328 } |
309 | 329 |
310 | 330 |
OLD | NEW |