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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <list> | 10 #include <list> |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 // |end_time| in bytes. Can only be called after the index has been | 159 // |end_time| in bytes. Can only be called after the index has been |
160 // initialized. | 160 // initialized. |
161 uint64_t GetCacheSizeBetween(const base::Time initial_time, | 161 uint64_t GetCacheSizeBetween(const base::Time initial_time, |
162 const base::Time end_time) const; | 162 const base::Time end_time) const; |
163 | 163 |
164 // Returns whether the index has been initialized yet. | 164 // Returns whether the index has been initialized yet. |
165 bool initialized() const { return initialized_; } | 165 bool initialized() const { return initialized_; } |
166 | 166 |
167 IndexInitMethod init_method() const { return init_method_; } | 167 IndexInitMethod init_method() const { return init_method_; } |
168 | 168 |
| 169 // Returns the estimate of dynamically allocated memory in bytes. |
| 170 size_t EstimateMemoryUsage() const; |
| 171 |
169 private: | 172 private: |
170 friend class SimpleIndexTest; | 173 friend class SimpleIndexTest; |
171 FRIEND_TEST_ALL_PREFIXES(SimpleIndexTest, IndexSizeCorrectOnMerge); | 174 FRIEND_TEST_ALL_PREFIXES(SimpleIndexTest, IndexSizeCorrectOnMerge); |
172 FRIEND_TEST_ALL_PREFIXES(SimpleIndexTest, DiskWriteQueued); | 175 FRIEND_TEST_ALL_PREFIXES(SimpleIndexTest, DiskWriteQueued); |
173 FRIEND_TEST_ALL_PREFIXES(SimpleIndexTest, DiskWriteExecuted); | 176 FRIEND_TEST_ALL_PREFIXES(SimpleIndexTest, DiskWriteExecuted); |
174 FRIEND_TEST_ALL_PREFIXES(SimpleIndexTest, DiskWritePostponed); | 177 FRIEND_TEST_ALL_PREFIXES(SimpleIndexTest, DiskWritePostponed); |
175 | 178 |
176 void StartEvictionIfNeeded(); | 179 void StartEvictionIfNeeded(); |
177 void EvictionDone(int result); | 180 void EvictionDone(int result); |
178 | 181 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 234 |
232 // Set to true when the app is on the background. When the app is in the | 235 // Set to true when the app is on the background. When the app is in the |
233 // background we can write the index much more frequently, to insure fresh | 236 // background we can write the index much more frequently, to insure fresh |
234 // index on next startup. | 237 // index on next startup. |
235 bool app_on_background_; | 238 bool app_on_background_; |
236 }; | 239 }; |
237 | 240 |
238 } // namespace disk_cache | 241 } // namespace disk_cache |
239 | 242 |
240 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_ | 243 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_ |
OLD | NEW |