Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: content/common/gpu/gpu_channel_manager.cc

Issue 1308913004: GPU Channel's now maintain a global order number for each processed IPC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: GPU Channel message queue placed in own class, applied suggestions Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698