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/gpu_channel_manager.h" | 5 #include "content/common/gpu/gpu_channel_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "content/common/child_thread.h" | 9 #include "content/common/child_thread.h" |
10 #include "content/common/gpu/gpu_channel.h" | 10 #include "content/common/gpu/gpu_channel.h" |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 delete image_operations_.front(); | 252 delete image_operations_.front(); |
253 image_operations_.pop_front(); | 253 image_operations_.pop_front(); |
254 } | 254 } |
255 } | 255 } |
256 | 256 |
257 void GpuChannelManager::OnLoadedShader(std::string program_proto) { | 257 void GpuChannelManager::OnLoadedShader(std::string program_proto) { |
258 if (program_cache()) | 258 if (program_cache()) |
259 program_cache()->LoadProgram(program_proto); | 259 program_cache()->LoadProgram(program_proto); |
260 } | 260 } |
261 | 261 |
| 262 bool GpuChannelManager::HandleMessagesScheduled() { |
| 263 for (GpuChannelMap::iterator iter = gpu_channels_.begin(); |
| 264 iter != gpu_channels_.end(); ++iter) { |
| 265 if (iter->second->handle_messages_scheduled()) |
| 266 return true; |
| 267 } |
| 268 return false; |
| 269 } |
| 270 |
| 271 uint64 GpuChannelManager::MessagesProcessed() { |
| 272 uint64 messages_processed = 0; |
| 273 |
| 274 for (GpuChannelMap::iterator iter = gpu_channels_.begin(); |
| 275 iter != gpu_channels_.end(); ++iter) { |
| 276 messages_processed += iter->second->messages_processed(); |
| 277 } |
| 278 return messages_processed; |
| 279 } |
| 280 |
262 void GpuChannelManager::LoseAllContexts() { | 281 void GpuChannelManager::LoseAllContexts() { |
263 MessageLoop::current()->PostTask( | 282 MessageLoop::current()->PostTask( |
264 FROM_HERE, | 283 FROM_HERE, |
265 base::Bind(&GpuChannelManager::OnLoseAllContexts, | 284 base::Bind(&GpuChannelManager::OnLoseAllContexts, |
266 weak_factory_.GetWeakPtr())); | 285 weak_factory_.GetWeakPtr())); |
267 } | 286 } |
268 | 287 |
269 void GpuChannelManager::OnLoseAllContexts() { | 288 void GpuChannelManager::OnLoseAllContexts() { |
270 gpu_channels_.clear(); | 289 gpu_channels_.clear(); |
271 } | 290 } |
272 | 291 |
273 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { | 292 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { |
274 if (!default_offscreen_surface_.get()) { | 293 if (!default_offscreen_surface_.get()) { |
275 default_offscreen_surface_ = gfx::GLSurface::CreateOffscreenGLSurface( | 294 default_offscreen_surface_ = gfx::GLSurface::CreateOffscreenGLSurface( |
276 false, gfx::Size(1, 1)); | 295 false, gfx::Size(1, 1)); |
277 } | 296 } |
278 return default_offscreen_surface_.get(); | 297 return default_offscreen_surface_.get(); |
279 } | 298 } |
280 | 299 |
281 } // namespace content | 300 } // namespace content |
OLD | NEW |