Chromium Code Reviews| 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 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(const size_t max_cache_size_bytes, |
| 28 explicit MemoryProgramCache(const size_t max_cache_size_bytes); | 31 const bool disable_gpu_shader_disk_cache); |
|
piman
2016/02/24 22:19:08
nit: no const in the parameters, unless they're re
Peng
2016/02/25 16:18:36
Done.
| |
| 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 Loading... | |
| 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_ |
| OLD | NEW |