| 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 "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 } | 248 } |
| 249 | 249 |
| 250 bool GpuChannelManager::HandleMessagesScheduled() { | 250 bool GpuChannelManager::HandleMessagesScheduled() { |
| 251 for (auto& kv : gpu_channels_) { | 251 for (auto& kv : gpu_channels_) { |
| 252 if (kv.second->handle_messages_scheduled()) | 252 if (kv.second->handle_messages_scheduled()) |
| 253 return true; | 253 return true; |
| 254 } | 254 } |
| 255 return false; | 255 return false; |
| 256 } | 256 } |
| 257 | 257 |
| 258 uint64 GpuChannelManager::MessagesProcessed() { | 258 uint32_t GpuChannelManager::ProcessedOrderNumber() { |
| 259 uint64 messages_processed = 0; | 259 uint32_t processed_order_num = 0; |
| 260 for (auto& kv : gpu_channels_) | 260 for (auto& kv : gpu_channels_) { |
| 261 messages_processed += kv.second->messages_processed(); | 261 processed_order_num = std::max(processed_order_num, |
| 262 return messages_processed; | 262 kv.second->GetProcessedOrderNum()); |
| 263 } |
| 264 return processed_order_num; |
| 263 } | 265 } |
| 264 | 266 |
| 265 void GpuChannelManager::LoseAllContexts() { | 267 void GpuChannelManager::LoseAllContexts() { |
| 266 for (auto& kv : gpu_channels_) | 268 for (auto& kv : gpu_channels_) { |
| 267 kv.second->MarkAllContextsLost(); | 269 kv.second->MarkAllContextsLost(); |
| 270 } |
| 268 task_runner_->PostTask(FROM_HERE, | 271 task_runner_->PostTask(FROM_HERE, |
| 269 base::Bind(&GpuChannelManager::OnLoseAllContexts, | 272 base::Bind(&GpuChannelManager::OnLoseAllContexts, |
| 270 weak_factory_.GetWeakPtr())); | 273 weak_factory_.GetWeakPtr())); |
| 271 } | 274 } |
| 272 | 275 |
| 273 void GpuChannelManager::OnLoseAllContexts() { | 276 void GpuChannelManager::OnLoseAllContexts() { |
| 274 gpu_channels_.clear(); | 277 gpu_channels_.clear(); |
| 275 } | 278 } |
| 276 | 279 |
| 277 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { | 280 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { |
| 278 if (!default_offscreen_surface_.get()) { | 281 if (!default_offscreen_surface_.get()) { |
| 279 default_offscreen_surface_ = | 282 default_offscreen_surface_ = |
| 280 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size()); | 283 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size()); |
| 281 } | 284 } |
| 282 return default_offscreen_surface_.get(); | 285 return default_offscreen_surface_.get(); |
| 283 } | 286 } |
| 284 | 287 |
| 285 } // namespace content | 288 } // namespace content |
| OLD | NEW |