| 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 <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/ref_counted.h" | 17 #include "base/memory/ref_counted.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 | 22 |
| 23 class GpuProcessActivityFlags; |
| 24 |
| 23 namespace gles2 { | 25 namespace gles2 { |
| 24 | 26 |
| 25 // Program cache that stores binaries completely in-memory | 27 // Program cache that stores binaries completely in-memory |
| 26 class GPU_EXPORT MemoryProgramCache : public ProgramCache { | 28 class GPU_EXPORT MemoryProgramCache : public ProgramCache { |
| 27 public: | 29 public: |
| 28 MemoryProgramCache(size_t max_cache_size_bytes, | 30 MemoryProgramCache(size_t max_cache_size_bytes, |
| 29 bool disable_gpu_shader_disk_cache, | 31 bool disable_gpu_shader_disk_cache, |
| 30 bool disable_program_caching_for_transform_feedback); | 32 bool disable_program_caching_for_transform_feedback, |
| 33 GpuProcessActivityFlags* activity_flags); |
| 31 ~MemoryProgramCache() override; | 34 ~MemoryProgramCache() override; |
| 32 | 35 |
| 33 ProgramLoadResult LoadLinkedProgram( | 36 ProgramLoadResult LoadLinkedProgram( |
| 34 GLuint program, | 37 GLuint program, |
| 35 Shader* shader_a, | 38 Shader* shader_a, |
| 36 Shader* shader_b, | 39 Shader* shader_b, |
| 37 const LocationMap* bind_attrib_location_map, | 40 const LocationMap* bind_attrib_location_map, |
| 38 const std::vector<std::string>& transform_feedback_varyings, | 41 const std::vector<std::string>& transform_feedback_varyings, |
| 39 GLenum transform_feedback_buffer_mode, | 42 GLenum transform_feedback_buffer_mode, |
| 40 const ShaderCacheCallback& shader_callback) override; | 43 const ShaderCacheCallback& shader_callback) override; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 friend class ProgramCacheValue; | 164 friend class ProgramCacheValue; |
| 162 | 165 |
| 163 typedef base::MRUCache<std::string, | 166 typedef base::MRUCache<std::string, |
| 164 scoped_refptr<ProgramCacheValue> > ProgramMRUCache; | 167 scoped_refptr<ProgramCacheValue> > ProgramMRUCache; |
| 165 | 168 |
| 166 const size_t max_size_bytes_; | 169 const size_t max_size_bytes_; |
| 167 const bool disable_gpu_shader_disk_cache_; | 170 const bool disable_gpu_shader_disk_cache_; |
| 168 const bool disable_program_caching_for_transform_feedback_; | 171 const bool disable_program_caching_for_transform_feedback_; |
| 169 size_t curr_size_bytes_; | 172 size_t curr_size_bytes_; |
| 170 ProgramMRUCache store_; | 173 ProgramMRUCache store_; |
| 174 GpuProcessActivityFlags* activity_flags_; |
| 171 | 175 |
| 172 DISALLOW_COPY_AND_ASSIGN(MemoryProgramCache); | 176 DISALLOW_COPY_AND_ASSIGN(MemoryProgramCache); |
| 173 }; | 177 }; |
| 174 | 178 |
| 175 } // namespace gles2 | 179 } // namespace gles2 |
| 176 } // namespace gpu | 180 } // namespace gpu |
| 177 | 181 |
| 178 #endif // GPU_COMMAND_BUFFER_SERVICE_MEMORY_PROGRAM_CACHE_H_ | 182 #endif // GPU_COMMAND_BUFFER_SERVICE_MEMORY_PROGRAM_CACHE_H_ |
| OLD | NEW |