| 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 #if defined(ENABLE_GPU) | 8 #if defined(ENABLE_GPU) |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 StubMemoryStatMap; | 86 StubMemoryStatMap; |
| 87 const StubMemoryStatMap& stub_memory_stats_for_last_manage() const { | 87 const StubMemoryStatMap& stub_memory_stats_for_last_manage() const { |
| 88 return stub_memory_stats_for_last_manage_; | 88 return stub_memory_stats_for_last_manage_; |
| 89 } | 89 } |
| 90 | 90 |
| 91 // Tries to estimate the total available gpu memory for use by | 91 // Tries to estimate the total available gpu memory for use by |
| 92 // GpuMemoryManager. Ideally should consider other system applications and | 92 // GpuMemoryManager. Ideally should consider other system applications and |
| 93 // other internal but non GpuMemoryManager managed sources, etc. | 93 // other internal but non GpuMemoryManager managed sources, etc. |
| 94 size_t GetAvailableGpuMemory() const; | 94 size_t GetAvailableGpuMemory() const; |
| 95 | 95 |
| 96 // GetPeakAssignedAllocationSum() will return the historical max value for the | 96 // Track a change in memory allocated by any context |
| 97 // sum of all assigned client allocations (ie, peak system memory allocation). | 97 void TrackMemoryAllocatedChange(size_t old_size, size_t new_size); |
| 98 size_t peak_assigned_allocation_sum() const { | 98 |
| 99 return peak_assigned_allocation_sum_; | |
| 100 } | |
| 101 | 99 |
| 102 private: | 100 private: |
| 103 friend class GpuMemoryManagerTest; | 101 friend class GpuMemoryManagerTest; |
| 104 void Manage(); | 102 void Manage(); |
| 105 | 103 |
| 106 class CONTENT_EXPORT StubWithSurfaceComparator { | 104 class CONTENT_EXPORT StubWithSurfaceComparator { |
| 107 public: | 105 public: |
| 108 bool operator()(GpuCommandBufferStubBase* lhs, | 106 bool operator()(GpuCommandBufferStubBase* lhs, |
| 109 GpuCommandBufferStubBase* rhs); | 107 GpuCommandBufferStubBase* rhs); |
| 110 }; | 108 }; |
| 111 | 109 |
| 112 GpuMemoryManagerClient* client_; | 110 GpuMemoryManagerClient* client_; |
| 113 | 111 |
| 114 base::CancelableClosure delayed_manage_callback_; | 112 base::CancelableClosure delayed_manage_callback_; |
| 115 bool manage_immediate_scheduled_; | 113 bool manage_immediate_scheduled_; |
| 116 | 114 |
| 117 size_t max_surfaces_with_frontbuffer_soft_limit_; | 115 size_t max_surfaces_with_frontbuffer_soft_limit_; |
| 118 | 116 |
| 119 StubMemoryStatMap stub_memory_stats_for_last_manage_; | 117 StubMemoryStatMap stub_memory_stats_for_last_manage_; |
| 120 size_t peak_assigned_allocation_sum_; | 118 |
| 119 // The current total memory usage, and historical maximum memory usage |
| 120 size_t bytes_allocated_current_; |
| 121 size_t bytes_allocated_historical_max_; |
| 121 | 122 |
| 122 DISALLOW_COPY_AND_ASSIGN(GpuMemoryManager); | 123 DISALLOW_COPY_AND_ASSIGN(GpuMemoryManager); |
| 123 }; | 124 }; |
| 124 | 125 |
| 125 #endif | 126 #endif |
| 126 | 127 |
| 127 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ | 128 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ |
| OLD | NEW |