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

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

Issue 1716813002: Use GpuPreferences to avoid directly accessing switches in gpu related code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 4 years, 9 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 <string> 11 #include <string>
12 12
13 #include "base/containers/hash_tables.h" 13 #include "base/containers/hash_tables.h"
14 #include "base/containers/mru_cache.h" 14 #include "base/containers/mru_cache.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 18 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
19 #include "gpu/command_buffer/service/program_cache.h" 19 #include "gpu/command_buffer/service/program_cache.h"
20 20
21 namespace gpu { 21 namespace gpu {
22
23 struct GpuPreferences;
24
22 namespace gles2 { 25 namespace gles2 {
23 26
24 // Program cache that stores binaries completely in-memory 27 // Program cache that stores binaries completely in-memory
25 class GPU_EXPORT MemoryProgramCache : public ProgramCache { 28 class GPU_EXPORT MemoryProgramCache : public ProgramCache {
26 public: 29 public:
27 MemoryProgramCache(); 30 MemoryProgramCache(size_t max_cache_size_bytes,
28 explicit MemoryProgramCache(const size_t max_cache_size_bytes); 31 bool disable_gpu_shader_disk_cache);
29 ~MemoryProgramCache() override; 32 ~MemoryProgramCache() override;
30 33
31 ProgramLoadResult LoadLinkedProgram( 34 ProgramLoadResult LoadLinkedProgram(
32 GLuint program, 35 GLuint program,
33 Shader* shader_a, 36 Shader* shader_a,
34 Shader* shader_b, 37 Shader* shader_b,
35 const LocationMap* bind_attrib_location_map, 38 const LocationMap* bind_attrib_location_map,
36 const std::vector<std::string>& transform_feedback_varyings, 39 const std::vector<std::string>& transform_feedback_varyings,
37 GLenum transform_feedback_buffer_mode, 40 GLenum transform_feedback_buffer_mode,
38 const ShaderCacheCallback& shader_callback) override; 41 const ShaderCacheCallback& shader_callback) override;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 146
144 DISALLOW_COPY_AND_ASSIGN(ProgramCacheValue); 147 DISALLOW_COPY_AND_ASSIGN(ProgramCacheValue);
145 }; 148 };
146 149
147 friend class ProgramCacheValue; 150 friend class ProgramCacheValue;
148 151
149 typedef base::MRUCache<std::string, 152 typedef base::MRUCache<std::string,
150 scoped_refptr<ProgramCacheValue> > ProgramMRUCache; 153 scoped_refptr<ProgramCacheValue> > ProgramMRUCache;
151 154
152 const size_t max_size_bytes_; 155 const size_t max_size_bytes_;
156 const bool disable_gpu_shader_disk_cache_;
153 size_t curr_size_bytes_; 157 size_t curr_size_bytes_;
154 ProgramMRUCache store_; 158 ProgramMRUCache store_;
155 159
156 DISALLOW_COPY_AND_ASSIGN(MemoryProgramCache); 160 DISALLOW_COPY_AND_ASSIGN(MemoryProgramCache);
157 }; 161 };
158 162
159 } // namespace gles2 163 } // namespace gles2
160 } // namespace gpu 164 } // namespace gpu
161 165
162 #endif // GPU_COMMAND_BUFFER_SERVICE_MEMORY_PROGRAM_CACHE_H_ 166 #endif // GPU_COMMAND_BUFFER_SERVICE_MEMORY_PROGRAM_CACHE_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/mailbox_manager.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