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