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 NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_ | 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_ |
6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_ | 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // disk cache backend interface. | 123 // disk cache backend interface. |
124 scoped_ptr<HashList> GetEntriesBetween(const base::Time initial_time, | 124 scoped_ptr<HashList> GetEntriesBetween(const base::Time initial_time, |
125 const base::Time end_time); | 125 const base::Time end_time); |
126 | 126 |
127 // Returns the list of all entries key hash. | 127 // Returns the list of all entries key hash. |
128 scoped_ptr<HashList> GetAllHashes(); | 128 scoped_ptr<HashList> GetAllHashes(); |
129 | 129 |
130 // Returns number of indexed entries. | 130 // Returns number of indexed entries. |
131 int32 GetEntryCount() const; | 131 int32 GetEntryCount() const; |
132 | 132 |
| 133 // Returns the size of the entire cache in bytes. Can only be called after the |
| 134 // index has been initialized. |
| 135 uint64 GetCacheSize() const; |
| 136 |
133 // Returns whether the index has been initialized yet. | 137 // Returns whether the index has been initialized yet. |
134 bool initialized() const { return initialized_; } | 138 bool initialized() const { return initialized_; } |
135 | 139 |
136 private: | 140 private: |
137 friend class SimpleIndexTest; | 141 friend class SimpleIndexTest; |
138 FRIEND_TEST_ALL_PREFIXES(SimpleIndexTest, IndexSizeCorrectOnMerge); | 142 FRIEND_TEST_ALL_PREFIXES(SimpleIndexTest, IndexSizeCorrectOnMerge); |
139 FRIEND_TEST_ALL_PREFIXES(SimpleIndexTest, DiskWriteQueued); | 143 FRIEND_TEST_ALL_PREFIXES(SimpleIndexTest, DiskWriteQueued); |
140 FRIEND_TEST_ALL_PREFIXES(SimpleIndexTest, DiskWriteExecuted); | 144 FRIEND_TEST_ALL_PREFIXES(SimpleIndexTest, DiskWriteExecuted); |
141 FRIEND_TEST_ALL_PREFIXES(SimpleIndexTest, DiskWritePostponed); | 145 FRIEND_TEST_ALL_PREFIXES(SimpleIndexTest, DiskWritePostponed); |
142 | 146 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 199 |
196 // Set to true when the app is on the background. When the app is in the | 200 // Set to true when the app is on the background. When the app is in the |
197 // background we can write the index much more frequently, to insure fresh | 201 // background we can write the index much more frequently, to insure fresh |
198 // index on next startup. | 202 // index on next startup. |
199 bool app_on_background_; | 203 bool app_on_background_; |
200 }; | 204 }; |
201 | 205 |
202 } // namespace disk_cache | 206 } // namespace disk_cache |
203 | 207 |
204 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_ | 208 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_ |
OLD | NEW |