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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 base::Time GetLastUsedTime() const; | 51 base::Time GetLastUsedTime() const; |
52 void SetLastUsedTime(const base::Time& last_used_time); | 52 void SetLastUsedTime(const base::Time& last_used_time); |
53 | 53 |
54 uint32_t GetEntrySize() const; | 54 uint32_t GetEntrySize() const; |
55 void SetEntrySize(base::StrictNumeric<uint32_t> entry_size); | 55 void SetEntrySize(base::StrictNumeric<uint32_t> entry_size); |
56 | 56 |
57 // Serialize the data into the provided pickle. | 57 // Serialize the data into the provided pickle. |
58 void Serialize(base::Pickle* pickle) const; | 58 void Serialize(base::Pickle* pickle) const; |
59 bool Deserialize(base::PickleIterator* it); | 59 bool Deserialize(base::PickleIterator* it); |
60 | 60 |
61 // Returns the estimate of dynamically allocated memory in bytes. | |
62 size_t EstimateMemoryUsage() const; | |
jkarlin
2017/02/21 16:23:29
Why did you remove this? Shouldn't this result in
xunjieli
2017/02/21 19:44:13
This is not SimpleIndex. This is EntryMetaData.
| |
63 | |
61 static base::TimeDelta GetLowerEpsilonForTimeComparisons() { | 64 static base::TimeDelta GetLowerEpsilonForTimeComparisons() { |
62 return base::TimeDelta::FromSeconds(1); | 65 return base::TimeDelta::FromSeconds(1); |
63 } | 66 } |
64 static base::TimeDelta GetUpperEpsilonForTimeComparisons() { | 67 static base::TimeDelta GetUpperEpsilonForTimeComparisons() { |
65 return base::TimeDelta(); | 68 return base::TimeDelta(); |
66 } | 69 } |
67 | 70 |
68 private: | 71 private: |
69 friend class SimpleIndexFileTest; | 72 friend class SimpleIndexFileTest; |
70 | 73 |
(...skipping 88 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 | 162 // |end_time| in bytes. Can only be called after the index has been |
160 // initialized. | 163 // initialized. |
161 uint64_t GetCacheSizeBetween(const base::Time initial_time, | 164 uint64_t GetCacheSizeBetween(const base::Time initial_time, |
162 const base::Time end_time) const; | 165 const base::Time end_time) const; |
163 | 166 |
164 // Returns whether the index has been initialized yet. | 167 // Returns whether the index has been initialized yet. |
165 bool initialized() const { return initialized_; } | 168 bool initialized() const { return initialized_; } |
166 | 169 |
167 IndexInitMethod init_method() const { return init_method_; } | 170 IndexInitMethod init_method() const { return init_method_; } |
168 | 171 |
172 // Returns the estimate of dynamically allocated memory in bytes. | |
173 size_t EstimateMemoryUsage() const; | |
174 | |
169 private: | 175 private: |
170 friend class SimpleIndexTest; | 176 friend class SimpleIndexTest; |
171 FRIEND_TEST_ALL_PREFIXES(SimpleIndexTest, IndexSizeCorrectOnMerge); | 177 FRIEND_TEST_ALL_PREFIXES(SimpleIndexTest, IndexSizeCorrectOnMerge); |
172 FRIEND_TEST_ALL_PREFIXES(SimpleIndexTest, DiskWriteQueued); | 178 FRIEND_TEST_ALL_PREFIXES(SimpleIndexTest, DiskWriteQueued); |
173 FRIEND_TEST_ALL_PREFIXES(SimpleIndexTest, DiskWriteExecuted); | 179 FRIEND_TEST_ALL_PREFIXES(SimpleIndexTest, DiskWriteExecuted); |
174 FRIEND_TEST_ALL_PREFIXES(SimpleIndexTest, DiskWritePostponed); | 180 FRIEND_TEST_ALL_PREFIXES(SimpleIndexTest, DiskWritePostponed); |
175 | 181 |
176 void StartEvictionIfNeeded(); | 182 void StartEvictionIfNeeded(); |
177 void EvictionDone(int result); | 183 void EvictionDone(int result); |
178 | 184 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
231 | 237 |
232 // Set to true when the app is on the background. When the app is in the | 238 // 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 | 239 // background we can write the index much more frequently, to insure fresh |
234 // index on next startup. | 240 // index on next startup. |
235 bool app_on_background_; | 241 bool app_on_background_; |
236 }; | 242 }; |
237 | 243 |
238 } // namespace disk_cache | 244 } // namespace disk_cache |
239 | 245 |
240 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_ | 246 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_ |
OLD | NEW |