| 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 ScheduleManage(kScheduleManageLater); | 315 ScheduleManage(kScheduleManageLater); |
| 316 | 316 |
| 317 if (GetCurrentUsage() > bytes_allocated_historical_max_) { | 317 if (GetCurrentUsage() > bytes_allocated_historical_max_) { |
| 318 bytes_allocated_historical_max_ = GetCurrentUsage(); | 318 bytes_allocated_historical_max_ = GetCurrentUsage(); |
| 319 // If we're blowing into new memory usage territory, spam the browser | 319 // If we're blowing into new memory usage territory, spam the browser |
| 320 // process with the most up-to-date information about our memory usage. | 320 // process with the most up-to-date information about our memory usage. |
| 321 SendUmaStatsToBrowser(); | 321 SendUmaStatsToBrowser(); |
| 322 } | 322 } |
| 323 } | 323 } |
| 324 | 324 |
| 325 bool GpuMemoryManager::EnsureGPUMemoryAvailable(size_t /* size_needed */) { |
| 326 // TODO: Check if there is enough space. Lose contexts until there is. |
| 327 return true; |
| 328 } |
| 329 |
| 325 GpuMemoryManagerClientState* GpuMemoryManager::CreateClientState( | 330 GpuMemoryManagerClientState* GpuMemoryManager::CreateClientState( |
| 326 GpuMemoryManagerClient* client, | 331 GpuMemoryManagerClient* client, |
| 327 bool has_surface, | 332 bool has_surface, |
| 328 bool visible) { | 333 bool visible) { |
| 329 TrackingGroupMap::iterator tracking_group_it = | 334 TrackingGroupMap::iterator tracking_group_it = |
| 330 tracking_groups_.find(client->GetMemoryTracker()); | 335 tracking_groups_.find(client->GetMemoryTracker()); |
| 331 DCHECK(tracking_group_it != tracking_groups_.end()); | 336 DCHECK(tracking_group_it != tracking_groups_.end()); |
| 332 GpuMemoryTrackingGroup* tracking_group = tracking_group_it->second; | 337 GpuMemoryTrackingGroup* tracking_group = tracking_group_it->second; |
| 333 | 338 |
| 334 GpuMemoryManagerClientState* client_state = new GpuMemoryManagerClientState( | 339 GpuMemoryManagerClientState* client_state = new GpuMemoryManagerClientState( |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 | 843 |
| 839 void GpuMemoryManager::RemoveClientFromList( | 844 void GpuMemoryManager::RemoveClientFromList( |
| 840 GpuMemoryManagerClientState* client_state) { | 845 GpuMemoryManagerClientState* client_state) { |
| 841 DCHECK(client_state->list_iterator_valid_); | 846 DCHECK(client_state->list_iterator_valid_); |
| 842 ClientStateList* client_list = GetClientList(client_state); | 847 ClientStateList* client_list = GetClientList(client_state); |
| 843 client_list->erase(client_state->list_iterator_); | 848 client_list->erase(client_state->list_iterator_); |
| 844 client_state->list_iterator_valid_ = false; | 849 client_state->list_iterator_valid_ = false; |
| 845 } | 850 } |
| 846 | 851 |
| 847 } // namespace content | 852 } // namespace content |
| OLD | NEW |