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

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: Fix merge error 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
« no previous file with comments | « content/common/gpu/gpu_channel_manager.h ('k') | content/common/gpu/gpu_command_buffer_stub.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <algorithm>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/command_line.h" 10 #include "base/command_line.h"
9 #include "base/location.h" 11 #include "base/location.h"
10 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
11 #include "base/thread_task_runner_handle.h" 13 #include "base/thread_task_runner_handle.h"
12 #include "content/common/gpu/gpu_channel.h" 14 #include "content/common/gpu/gpu_channel.h"
13 #include "content/common/gpu/gpu_memory_buffer_factory.h" 15 #include "content/common/gpu/gpu_memory_buffer_factory.h"
14 #include "content/common/gpu/gpu_memory_manager.h" 16 #include "content/common/gpu/gpu_memory_manager.h"
15 #include "content/common/gpu/gpu_messages.h" 17 #include "content/common/gpu/gpu_messages.h"
16 #include "content/common/message_router.h" 18 #include "content/common/message_router.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 auto it = gpu_channels_.find(client_id); 242 auto it = gpu_channels_.find(client_id);
241 if (it != gpu_channels_.end()) 243 if (it != gpu_channels_.end())
242 it->second->HandleUpdateValueState(target, state); 244 it->second->HandleUpdateValueState(target, state);
243 } 245 }
244 246
245 void GpuChannelManager::OnLoadedShader(std::string program_proto) { 247 void GpuChannelManager::OnLoadedShader(std::string program_proto) {
246 if (program_cache()) 248 if (program_cache())
247 program_cache()->LoadProgram(program_proto); 249 program_cache()->LoadProgram(program_proto);
248 } 250 }
249 251
250 bool GpuChannelManager::HandleMessagesScheduled() { 252 uint32_t GpuChannelManager::ProcessedOrderNumber() {
253 uint32_t processed_order_num = 0;
251 for (auto& kv : gpu_channels_) { 254 for (auto& kv : gpu_channels_) {
252 if (kv.second->handle_messages_scheduled()) 255 processed_order_num =
253 return true; 256 std::max(processed_order_num, kv.second->GetProcessedOrderNum());
254 } 257 }
255 return false; 258 return processed_order_num;
256 } 259 }
257 260
258 uint64 GpuChannelManager::MessagesProcessed() { 261 uint32_t GpuChannelManager::UnprocessedOrderNumber() {
259 uint64 messages_processed = 0; 262 uint32_t unprocessed_order_num = 0;
260 for (auto& kv : gpu_channels_) 263 for (auto& kv : gpu_channels_) {
261 messages_processed += kv.second->messages_processed(); 264 unprocessed_order_num =
262 return messages_processed; 265 std::max(unprocessed_order_num, kv.second->GetUnprocessedOrderNum());
266 }
267 return unprocessed_order_num;
263 } 268 }
264 269
265 void GpuChannelManager::LoseAllContexts() { 270 void GpuChannelManager::LoseAllContexts() {
266 for (auto& kv : gpu_channels_) 271 for (auto& kv : gpu_channels_) {
267 kv.second->MarkAllContextsLost(); 272 kv.second->MarkAllContextsLost();
273 }
268 task_runner_->PostTask(FROM_HERE, 274 task_runner_->PostTask(FROM_HERE,
269 base::Bind(&GpuChannelManager::OnLoseAllContexts, 275 base::Bind(&GpuChannelManager::OnLoseAllContexts,
270 weak_factory_.GetWeakPtr())); 276 weak_factory_.GetWeakPtr()));
271 } 277 }
272 278
273 void GpuChannelManager::OnLoseAllContexts() { 279 void GpuChannelManager::OnLoseAllContexts() {
274 gpu_channels_.clear(); 280 gpu_channels_.clear();
275 } 281 }
276 282
277 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { 283 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() {
278 if (!default_offscreen_surface_.get()) { 284 if (!default_offscreen_surface_.get()) {
279 default_offscreen_surface_ = 285 default_offscreen_surface_ =
280 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size()); 286 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size());
281 } 287 }
282 return default_offscreen_surface_.get(); 288 return default_offscreen_surface_.get();
283 } 289 }
284 290
285 } // namespace content 291 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_channel_manager.h ('k') | content/common/gpu/gpu_command_buffer_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698