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

Side by Side Diff: content/browser/gpu/shader_disk_cache.h

Issue 17283002: Set max disk cache size correctly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/gpu/gpu_process_host.cc ('k') | content/browser/gpu/shader_disk_cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 27 matching lines...) Expand all
77 ~ShaderDiskCache(); 74 ~ShaderDiskCache();
78 75
79 void CacheCreatedCallback(int rv); 76 void CacheCreatedCallback(int rv);
80 77
81 disk_cache::Backend* backend() { return backend_; } 78 disk_cache::Backend* backend() { return backend_; }
82 79
83 void EntryComplete(void* entry); 80 void EntryComplete(void* entry);
84 void ReadComplete(); 81 void ReadComplete();
85 82
86 bool cache_available_; 83 bool cache_available_;
87 size_t max_cache_size_;
88 int host_id_; 84 int host_id_;
89 base::FilePath cache_path_; 85 base::FilePath cache_path_;
90 bool is_initialized_; 86 bool is_initialized_;
91 net::CompletionCallback available_callback_; 87 net::CompletionCallback available_callback_;
92 net::CompletionCallback cache_complete_callback_; 88 net::CompletionCallback cache_complete_callback_;
93 89
94 disk_cache::Backend* backend_; 90 disk_cache::Backend* backend_;
95 91
96 scoped_refptr<ShaderDiskReadHelper> helper_; 92 scoped_refptr<ShaderDiskReadHelper> helper_;
97 std::map<void*, scoped_refptr<ShaderDiskCacheEntry> > entry_map_; 93 std::map<void*, scoped_refptr<ShaderDiskCacheEntry> > entry_map_;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 typedef std::map<base::FilePath, ShaderClearQueue> ShaderClearMap; 145 typedef std::map<base::FilePath, ShaderClearQueue> ShaderClearMap;
150 ShaderClearMap shader_clear_map_; 146 ShaderClearMap shader_clear_map_;
151 147
152 DISALLOW_COPY_AND_ASSIGN(ShaderCacheFactory); 148 DISALLOW_COPY_AND_ASSIGN(ShaderCacheFactory);
153 }; 149 };
154 150
155 } // namespace content 151 } // namespace content
156 152
157 #endif // CONTENT_BROWSER_GPU_SHADER_DISK_CACHE_H_ 153 #endif // CONTENT_BROWSER_GPU_SHADER_DISK_CACHE_H_
158 154
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host.cc ('k') | content/browser/gpu/shader_disk_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698