Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: content/common/gpu/gpu_memory_manager.h

Issue 11944002: Make names consistent in GpuMemoryManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit test build Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/common/gpu/gpu_memory_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 TestUnmanagedTracking); 96 TestUnmanagedTracking);
97 97
98 typedef std::map<gpu::gles2::MemoryTracker*, GpuMemoryTrackingGroup*> 98 typedef std::map<gpu::gles2::MemoryTracker*, GpuMemoryTrackingGroup*>
99 TrackingGroupMap; 99 TrackingGroupMap;
100 100
101 typedef std::list<GpuMemoryManagerClientState*> ClientStateList; 101 typedef std::list<GpuMemoryManagerClientState*> ClientStateList;
102 102
103 void Manage(); 103 void Manage();
104 void SetClientsHibernatedState() const; 104 void SetClientsHibernatedState() const;
105 size_t GetVisibleClientAllocation() const; 105 size_t GetVisibleClientAllocation() const;
106 size_t GetCurrentBackgroundedAvailableGpuMemory() const; 106 size_t GetCurrentNonvisibleAvailableGpuMemory() const;
107 void AssignSurfacesAllocationsNonuniform(); 107 void AssignSurfacesAllocationsNonuniform();
108 void AssignSurfacesAllocationsUniform(); 108 void AssignSurfacesAllocationsUniform();
109 void AssignNonSurfacesAllocations(); 109 void AssignNonSurfacesAllocations();
110 110
111 // Update the amount of GPU memory we think we have in the system, based 111 // Update the amount of GPU memory we think we have in the system, based
112 // on what the stubs' contexts report. 112 // on what the stubs' contexts report.
113 void UpdateAvailableGpuMemory(); 113 void UpdateAvailableGpuMemory();
114 void UpdateUnmanagedMemoryLimits(); 114 void UpdateUnmanagedMemoryLimits();
115 void UpdateBackgroundedAvailableGpuMemory(); 115 void UpdateNonvisibleAvailableGpuMemory();
116 116
117 // The amount of video memory which is available for allocation. 117 // The amount of video memory which is available for allocation.
118 size_t GetAvailableGpuMemory() const; 118 size_t GetAvailableGpuMemory() const;
119 119
120 // Minimum value of available GPU memory, no matter how little the GPU 120 // Minimum value of available GPU memory, no matter how little the GPU
121 // reports. This is the default value. 121 // reports. This is the default value.
122 size_t GetDefaultAvailableGpuMemory() const; 122 size_t GetDefaultAvailableGpuMemory() const;
123 123
124 // Maximum cap on total GPU memory, no matter how much the GPU reports. 124 // Maximum cap on total GPU memory, no matter how much the GPU reports.
125 size_t GetMaximumTotalGpuMemory() const; 125 size_t GetMaximumTotalGpuMemory() const;
126 126
127 // The maximum and minimum amount of memory that a tab may be assigned. 127 // The maximum and minimum amount of memory that a tab may be assigned.
128 size_t GetMaximumTabAllocation() const; 128 size_t GetMaximumClientAllocation() const;
129 size_t GetMinimumTabAllocation() const; 129 size_t GetMinimumClientAllocation() const;
130 130
131 // Get a reasonable memory limit from a viewport's surface area. 131 // Get a reasonable memory limit from a viewport's surface area.
132 static size_t CalcAvailableFromViewportArea(int viewport_area); 132 static size_t CalcAvailableFromViewportArea(int viewport_area);
133 static size_t CalcAvailableFromGpuTotal(size_t total_gpu_memory); 133 static size_t CalcAvailableFromGpuTotal(size_t total_gpu_memory);
134 134
135 // Send memory usage stats to the browser process. 135 // Send memory usage stats to the browser process.
136 void SendUmaStatsToBrowser(); 136 void SendUmaStatsToBrowser();
137 137
138 // Get the current number of bytes allocated. 138 // Get the current number of bytes allocated.
139 size_t GetCurrentUsage() const { 139 size_t GetCurrentUsage() const {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 void TestingSetMinimumClientAllocation(size_t bytes) { 173 void TestingSetMinimumClientAllocation(size_t bytes) {
174 bytes_minimum_per_client_ = bytes; 174 bytes_minimum_per_client_ = bytes;
175 bytes_minimum_per_client_overridden_ = true; 175 bytes_minimum_per_client_overridden_ = true;
176 } 176 }
177 177
178 void TestingSetUnmanagedLimitStep(size_t bytes) { 178 void TestingSetUnmanagedLimitStep(size_t bytes) {
179 bytes_unmanaged_limit_step_ = bytes; 179 bytes_unmanaged_limit_step_ = bytes;
180 } 180 }
181 181
182 void TestingSetBackgroundedAvailableGpuMemory(size_t bytes) { 182 void TestingSetNonvisibleAvailableGpuMemory(size_t bytes) {
183 bytes_backgrounded_available_gpu_memory_ = bytes; 183 bytes_nonvisible_available_gpu_memory_ = bytes;
184 } 184 }
185 185
186 GpuChannelManager* channel_manager_; 186 GpuChannelManager* channel_manager_;
187 187
188 // The new memory policy does not uniformly assign memory to tabs, but 188 // The new memory policy does not uniformly assign memory to tabs, but
189 // scales the assignments to the tabs' needs. 189 // scales the assignments to the tabs' needs.
190 bool use_nonuniform_memory_policy_; 190 bool use_nonuniform_memory_policy_;
191 191
192 // A list of all visible and nonvisible clients, in most-recently-used 192 // A list of all visible and nonvisible clients, in most-recently-used
193 // order (most recently used is first). 193 // order (most recently used is first).
(...skipping 13 matching lines...) Expand all
207 207
208 // The maximum amount of memory that may be allocated for GPU resources 208 // The maximum amount of memory that may be allocated for GPU resources
209 size_t bytes_available_gpu_memory_; 209 size_t bytes_available_gpu_memory_;
210 bool bytes_available_gpu_memory_overridden_; 210 bool bytes_available_gpu_memory_overridden_;
211 211
212 // The minimum allocation that may be given to a single renderer. 212 // The minimum allocation that may be given to a single renderer.
213 size_t bytes_minimum_per_client_; 213 size_t bytes_minimum_per_client_;
214 bool bytes_minimum_per_client_overridden_; 214 bool bytes_minimum_per_client_overridden_;
215 215
216 // The maximum amount of memory that can be allocated for GPU resources 216 // The maximum amount of memory that can be allocated for GPU resources
217 // in backgrounded renderers. 217 // in nonvisible renderers.
218 size_t bytes_backgrounded_available_gpu_memory_; 218 size_t bytes_nonvisible_available_gpu_memory_;
219 219
220 // The current total memory usage, and historical maximum memory usage 220 // The current total memory usage, and historical maximum memory usage
221 size_t bytes_allocated_managed_current_; 221 size_t bytes_allocated_managed_current_;
222 size_t bytes_allocated_managed_visible_; 222 size_t bytes_allocated_managed_visible_;
223 size_t bytes_allocated_managed_backgrounded_; 223 size_t bytes_allocated_managed_nonvisible_;
224 size_t bytes_allocated_unmanaged_current_; 224 size_t bytes_allocated_unmanaged_current_;
225 size_t bytes_allocated_historical_max_; 225 size_t bytes_allocated_historical_max_;
226 226
227 // If bytes_allocated_unmanaged_current_ leaves the interval [low_, high_), 227 // If bytes_allocated_unmanaged_current_ leaves the interval [low_, high_),
228 // then ScheduleManage to take the change into account. 228 // then ScheduleManage to take the change into account.
229 size_t bytes_allocated_unmanaged_high_; 229 size_t bytes_allocated_unmanaged_high_;
230 size_t bytes_allocated_unmanaged_low_; 230 size_t bytes_allocated_unmanaged_low_;
231 231
232 // Update bytes_allocated_unmanaged_low/high_ in intervals of step_. 232 // Update bytes_allocated_unmanaged_low/high_ in intervals of step_.
233 size_t bytes_unmanaged_limit_step_; 233 size_t bytes_unmanaged_limit_step_;
234 234
235 // The number of browser windows that exist. If we ever receive a 235 // The number of browser windows that exist. If we ever receive a
236 // GpuMsg_SetVideoMemoryWindowCount, then we use this to compute memory 236 // GpuMsg_SetVideoMemoryWindowCount, then we use this to compute memory
237 // budgets, instead of doing more complicated stub-based calculations. 237 // allocations, instead of doing more complicated stub-based calculations.
238 bool window_count_has_been_received_; 238 bool window_count_has_been_received_;
239 uint32 window_count_; 239 uint32 window_count_;
240 240
241 // Used to disable automatic changes to Manage() in testing. 241 // Used to disable automatic changes to Manage() in testing.
242 bool disable_schedule_manage_; 242 bool disable_schedule_manage_;
243 243
244 DISALLOW_COPY_AND_ASSIGN(GpuMemoryManager); 244 DISALLOW_COPY_AND_ASSIGN(GpuMemoryManager);
245 }; 245 };
246 246
247 } // namespace content 247 } // namespace content
248 248
249 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ 249 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | content/common/gpu/gpu_memory_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698