| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_BROWSER_GPU_SHADER_DISK_CACHE_H_ | 5 #ifndef CONTENT_BROWSER_GPU_SHADER_DISK_CACHE_H_ |
| 6 #define CONTENT_BROWSER_GPU_SHADER_DISK_CACHE_H_ | 6 #define CONTENT_BROWSER_GPU_SHADER_DISK_CACHE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // While this class is both RefCounted and SupportsWeakPtr | 27 // While this class is both RefCounted and SupportsWeakPtr |
| 28 // when using this class you should work with the RefCounting. | 28 // when using this class you should work with the RefCounting. |
| 29 // The WeakPtr is needed interally. | 29 // The WeakPtr is needed interally. |
| 30 class CONTENT_EXPORT ShaderDiskCache | 30 class CONTENT_EXPORT ShaderDiskCache |
| 31 : public base::RefCounted<ShaderDiskCache>, | 31 : public base::RefCounted<ShaderDiskCache>, |
| 32 public base::SupportsWeakPtr<ShaderDiskCache> { | 32 public base::SupportsWeakPtr<ShaderDiskCache> { |
| 33 public: | 33 public: |
| 34 void Init(); | 34 void Init(); |
| 35 | 35 |
| 36 void set_host_id(int host_id) { host_id_ = host_id; } | 36 void set_host_id(int host_id) { host_id_ = host_id; } |
| 37 void set_max_cache_size(size_t max_cache_size) { | |
| 38 max_cache_size_ = max_cache_size; | |
| 39 } | |
| 40 | 37 |
| 41 // Store the |shader| into the cache under |key|. | 38 // Store the |shader| into the cache under |key|. |
| 42 void Cache(const std::string& key, const std::string& shader); | 39 void Cache(const std::string& key, const std::string& shader); |
| 43 | 40 |
| 44 // Clear a range of entries. This supports unbounded deletes in either | 41 // Clear a range of entries. This supports unbounded deletes in either |
| 45 // direction by using null Time values for either |begin_time| or |end_time|. | 42 // direction by using null Time values for either |begin_time| or |end_time|. |
| 46 // The return value is a net error code. If this method returns | 43 // The return value is a net error code. If this method returns |
| 47 // ERR_IO_PENDING, the |completion_callback| will be invoked when the | 44 // ERR_IO_PENDING, the |completion_callback| will be invoked when the |
| 48 // operation completes. | 45 // operation completes. |
| 49 int Clear( | 46 int Clear( |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 typedef std::map<base::FilePath, ShaderClearQueue> ShaderClearMap; | 146 typedef std::map<base::FilePath, ShaderClearQueue> ShaderClearMap; |
| 150 ShaderClearMap shader_clear_map_; | 147 ShaderClearMap shader_clear_map_; |
| 151 | 148 |
| 152 DISALLOW_COPY_AND_ASSIGN(ShaderCacheFactory); | 149 DISALLOW_COPY_AND_ASSIGN(ShaderCacheFactory); |
| 153 }; | 150 }; |
| 154 | 151 |
| 155 } // namespace content | 152 } // namespace content |
| 156 | 153 |
| 157 #endif // CONTENT_BROWSER_GPU_SHADER_DISK_CACHE_H_ | 154 #endif // CONTENT_BROWSER_GPU_SHADER_DISK_CACHE_H_ |
| 158 | 155 |
| OLD | NEW |