| 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_memory_manager.h" | 5 #include "content/common/gpu/gpu_memory_manager.h" |
| 6 | 6 |
| 7 #if defined(ENABLE_GPU) | 7 #if defined(ENABLE_GPU) |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 const GpuMemoryTrackingGroup* tracking_group = i->second; | 416 const GpuMemoryTrackingGroup* tracking_group = i->second; |
| 417 video_memory_usage_stats->process_map[ | 417 video_memory_usage_stats->process_map[ |
| 418 tracking_group->GetPid()].video_memory += tracking_group->GetSize(); | 418 tracking_group->GetPid()].video_memory += tracking_group->GetSize(); |
| 419 } | 419 } |
| 420 | 420 |
| 421 // Assign the total across all processes in the GPU process | 421 // Assign the total across all processes in the GPU process |
| 422 video_memory_usage_stats->process_map[ | 422 video_memory_usage_stats->process_map[ |
| 423 base::GetCurrentProcId()].video_memory = GetCurrentUsage(); | 423 base::GetCurrentProcId()].video_memory = GetCurrentUsage(); |
| 424 video_memory_usage_stats->process_map[ | 424 video_memory_usage_stats->process_map[ |
| 425 base::GetCurrentProcId()].has_duplicates = true; | 425 base::GetCurrentProcId()].has_duplicates = true; |
| 426 |
| 427 video_memory_usage_stats->bytes_allocated = GetCurrentUsage(); |
| 428 video_memory_usage_stats->bytes_allocated_historical_max = |
| 429 bytes_allocated_historical_max_; |
| 426 } | 430 } |
| 427 | 431 |
| 428 void GpuMemoryManager::SetWindowCount(uint32 window_count) { | 432 void GpuMemoryManager::SetWindowCount(uint32 window_count) { |
| 429 bool should_schedule_manage = !window_count_has_been_received_ || | 433 bool should_schedule_manage = !window_count_has_been_received_ || |
| 430 (window_count != window_count_); | 434 (window_count != window_count_); |
| 431 window_count_has_been_received_ = true; | 435 window_count_has_been_received_ = true; |
| 432 window_count_ = window_count; | 436 window_count_ = window_count; |
| 433 if (should_schedule_manage) | 437 if (should_schedule_manage) |
| 434 ScheduleManage(true); | 438 ScheduleManage(true); |
| 435 } | 439 } |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 GpuMemoryManagerClientState* client_state) { | 701 GpuMemoryManagerClientState* client_state) { |
| 698 DCHECK(client_state->list_iterator_valid_); | 702 DCHECK(client_state->list_iterator_valid_); |
| 699 ClientStateList* client_list = GetClientList(client_state); | 703 ClientStateList* client_list = GetClientList(client_state); |
| 700 client_list->erase(client_state->list_iterator_); | 704 client_list->erase(client_state->list_iterator_); |
| 701 client_state->list_iterator_valid_ = false; | 705 client_state->list_iterator_valid_ = false; |
| 702 } | 706 } |
| 703 | 707 |
| 704 } // namespace content | 708 } // namespace content |
| 705 | 709 |
| 706 #endif | 710 #endif |
| OLD | NEW |