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

Side by Side Diff: gpu/command_buffer/service/memory_program_cache.h

Issue 2921653005: GLES ProgramCache listens to memory pressure (Closed)
Patch Set: low-end check only on Android. Created 3 years, 6 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
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 GPU_COMMAND_BUFFER_SERVICE_MEMORY_PROGRAM_CACHE_H_ 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_MEMORY_PROGRAM_CACHE_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_MEMORY_PROGRAM_CACHE_H_ 6 #define GPU_COMMAND_BUFFER_SERVICE_MEMORY_PROGRAM_CACHE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
11 #include <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 13
14 #include "base/containers/hash_tables.h" 14 #include "base/containers/hash_tables.h"
15 #include "base/containers/mru_cache.h" 15 #include "base/containers/mru_cache.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/memory_pressure_listener.h"
17 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
18 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 19 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
19 #include "gpu/command_buffer/service/program_cache.h" 20 #include "gpu/command_buffer/service/program_cache.h"
20 21
21 namespace gpu { 22 namespace gpu {
22 23
23 class GpuProcessActivityFlags; 24 class GpuProcessActivityFlags;
24 25
25 namespace gles2 { 26 namespace gles2 {
26 27
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 MemoryProgramCache* const program_cache_; 160 MemoryProgramCache* const program_cache_;
160 161
161 DISALLOW_COPY_AND_ASSIGN(ProgramCacheValue); 162 DISALLOW_COPY_AND_ASSIGN(ProgramCacheValue);
162 }; 163 };
163 164
164 friend class ProgramCacheValue; 165 friend class ProgramCacheValue;
165 166
166 typedef base::MRUCache<std::string, 167 typedef base::MRUCache<std::string,
167 scoped_refptr<ProgramCacheValue> > ProgramMRUCache; 168 scoped_refptr<ProgramCacheValue> > ProgramMRUCache;
168 169
170 void HandleMemoryPressure(
171 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level);
172
169 const size_t max_size_bytes_; 173 const size_t max_size_bytes_;
170 const bool disable_gpu_shader_disk_cache_; 174 const bool disable_gpu_shader_disk_cache_;
171 const bool disable_program_caching_for_transform_feedback_; 175 const bool disable_program_caching_for_transform_feedback_;
172 size_t curr_size_bytes_; 176 size_t curr_size_bytes_;
173 ProgramMRUCache store_; 177 ProgramMRUCache store_;
174 GpuProcessActivityFlags* activity_flags_; 178 GpuProcessActivityFlags* activity_flags_;
175 179
180 base::MemoryPressureListener memory_pressure_listener_;
181
176 DISALLOW_COPY_AND_ASSIGN(MemoryProgramCache); 182 DISALLOW_COPY_AND_ASSIGN(MemoryProgramCache);
177 }; 183 };
178 184
179 } // namespace gles2 185 } // namespace gles2
180 } // namespace gpu 186 } // namespace gpu
181 187
182 #endif // GPU_COMMAND_BUFFER_SERVICE_MEMORY_PROGRAM_CACHE_H_ 188 #endif // GPU_COMMAND_BUFFER_SERVICE_MEMORY_PROGRAM_CACHE_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gpu_preferences.cc ('k') | gpu/command_buffer/service/memory_program_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698