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 #ifndef CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ | 5 #ifndef CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ |
6 #define CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ | 6 #define CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 uint64 GetMaximumClientAllocation() const; | 157 uint64 GetMaximumClientAllocation() const; |
158 uint64 GetMinimumClientAllocation() const { | 158 uint64 GetMinimumClientAllocation() const { |
159 return bytes_minimum_per_client_; | 159 return bytes_minimum_per_client_; |
160 } | 160 } |
161 // The default amount of memory that a client is assigned, if it has not | 161 // The default amount of memory that a client is assigned, if it has not |
162 // reported any memory usage stats yet. | 162 // reported any memory usage stats yet. |
163 uint64 GetDefaultClientAllocation() const { | 163 uint64 GetDefaultClientAllocation() const { |
164 return bytes_default_per_client_; | 164 return bytes_default_per_client_; |
165 } | 165 } |
166 | 166 |
167 // Get a reasonable memory limit from a viewport's surface area. | |
168 static uint64 CalcAvailableFromViewportArea(int viewport_area); | |
169 static uint64 CalcAvailableFromGpuTotal(uint64 total_gpu_memory); | 167 static uint64 CalcAvailableFromGpuTotal(uint64 total_gpu_memory); |
170 | 168 |
171 // Send memory usage stats to the browser process. | 169 // Send memory usage stats to the browser process. |
172 void SendUmaStatsToBrowser(); | 170 void SendUmaStatsToBrowser(); |
173 | 171 |
174 // Get the current number of bytes allocated. | 172 // Get the current number of bytes allocated. |
175 uint64 GetCurrentUsage() const { | 173 uint64 GetCurrentUsage() const { |
176 return bytes_allocated_managed_current_ + | 174 return bytes_allocated_managed_current_ + |
177 bytes_allocated_unmanaged_current_; | 175 bytes_allocated_unmanaged_current_; |
178 } | 176 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 | 281 |
284 // Used to disable automatic changes to Manage() in testing. | 282 // Used to disable automatic changes to Manage() in testing. |
285 bool disable_schedule_manage_; | 283 bool disable_schedule_manage_; |
286 | 284 |
287 DISALLOW_COPY_AND_ASSIGN(GpuMemoryManager); | 285 DISALLOW_COPY_AND_ASSIGN(GpuMemoryManager); |
288 }; | 286 }; |
289 | 287 |
290 } // namespace content | 288 } // namespace content |
291 | 289 |
292 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ | 290 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ |
OLD | NEW |