| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 DCHECK(bytes_allocated_current_ >= delta); | 142 DCHECK(bytes_allocated_current_ >= delta); |
| 143 bytes_allocated_current_ -= delta; | 143 bytes_allocated_current_ -= delta; |
| 144 } else { | 144 } else { |
| 145 size_t delta = new_size - old_size; | 145 size_t delta = new_size - old_size; |
| 146 bytes_allocated_current_ += delta; | 146 bytes_allocated_current_ += delta; |
| 147 if (bytes_allocated_current_ > bytes_allocated_historical_max_) { | 147 if (bytes_allocated_current_ > bytes_allocated_historical_max_) { |
| 148 bytes_allocated_historical_max_ = bytes_allocated_current_; | 148 bytes_allocated_historical_max_ = bytes_allocated_current_; |
| 149 } | 149 } |
| 150 } | 150 } |
| 151 if (new_size != old_size) { | 151 if (new_size != old_size) { |
| 152 TRACE_COUNTER_ID1("GpuMemoryManager", | 152 TRACE_COUNTER1("gpu", |
| 153 "GpuMemoryUsage", | 153 "GpuMemoryUsage", |
| 154 this, | 154 bytes_allocated_current_); |
| 155 bytes_allocated_current_); | |
| 156 } | 155 } |
| 157 } | 156 } |
| 158 | 157 |
| 159 void GpuMemoryManager::AddTrackingGroup( | 158 void GpuMemoryManager::AddTrackingGroup( |
| 160 GpuMemoryTrackingGroup* tracking_group) { | 159 GpuMemoryTrackingGroup* tracking_group) { |
| 161 tracking_groups_.insert(tracking_group); | 160 tracking_groups_.insert(tracking_group); |
| 162 } | 161 } |
| 163 | 162 |
| 164 void GpuMemoryManager::RemoveTrackingGroup( | 163 void GpuMemoryManager::RemoveTrackingGroup( |
| 165 GpuMemoryTrackingGroup* tracking_group) { | 164 GpuMemoryTrackingGroup* tracking_group) { |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 false); | 338 false); |
| 340 | 339 |
| 341 AssignMemoryAllocations( | 340 AssignMemoryAllocations( |
| 342 &stub_memory_stats_for_last_manage_, | 341 &stub_memory_stats_for_last_manage_, |
| 343 stubs_without_surface_hibernated, | 342 stubs_without_surface_hibernated, |
| 344 GpuMemoryAllocation(0, GpuMemoryAllocation::kHasNoBuffers), | 343 GpuMemoryAllocation(0, GpuMemoryAllocation::kHasNoBuffers), |
| 345 false); | 344 false); |
| 346 } | 345 } |
| 347 | 346 |
| 348 #endif | 347 #endif |
| OLD | NEW |