OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // See net/disk_cache/disk_cache.h for the public interface. | 5 // See net/disk_cache/disk_cache.h for the public interface. |
6 | 6 |
7 #ifndef NET_DISK_CACHE_RANKINGS_H_ | 7 #ifndef NET_DISK_CACHE_RANKINGS_H_ |
8 #define NET_DISK_CACHE_RANKINGS_H_ | 8 #define NET_DISK_CACHE_RANKINGS_H_ |
9 | 9 |
10 #include <list> | 10 #include <list> |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 140 |
141 private: | 141 private: |
142 typedef std::pair<CacheAddr, CacheRankingsBlock*> IteratorPair; | 142 typedef std::pair<CacheAddr, CacheRankingsBlock*> IteratorPair; |
143 typedef std::list<IteratorPair> IteratorList; | 143 typedef std::list<IteratorPair> IteratorList; |
144 | 144 |
145 void ReadHeads(); | 145 void ReadHeads(); |
146 void ReadTails(); | 146 void ReadTails(); |
147 void WriteHead(List list); | 147 void WriteHead(List list); |
148 void WriteTail(List list); | 148 void WriteTail(List list); |
149 | 149 |
150 // Gets the rankings information for a given rankings node. | 150 // Gets the rankings information for a given rankings node. We may end up |
| 151 // sharing the actual memory with a loaded entry, but we are not taking a |
| 152 // reference to that entry, so |rankings| must be short lived. |
151 bool GetRanking(CacheRankingsBlock* rankings); | 153 bool GetRanking(CacheRankingsBlock* rankings); |
152 | 154 |
| 155 // Makes |rankings| suitable to live a long life. |
| 156 void ConvertToLongLived(CacheRankingsBlock* rankings); |
| 157 |
153 // Finishes a list modification after a crash. | 158 // Finishes a list modification after a crash. |
154 void CompleteTransaction(); | 159 void CompleteTransaction(); |
155 void FinishInsert(CacheRankingsBlock* rankings); | 160 void FinishInsert(CacheRankingsBlock* rankings); |
156 void RevertRemove(CacheRankingsBlock* rankings); | 161 void RevertRemove(CacheRankingsBlock* rankings); |
157 | 162 |
158 // Returns false if this entry will not be recognized as dirty (called during | 163 // Returns false if this entry will not be recognized as dirty (called during |
159 // selfcheck). | 164 // selfcheck). |
160 bool CheckEntry(CacheRankingsBlock* rankings); | 165 bool CheckEntry(CacheRankingsBlock* rankings); |
161 | 166 |
162 // Returns false if node is not properly linked. | 167 // Returns false if node is not properly linked. |
(...skipping 28 matching lines...) Expand all Loading... |
191 BackendImpl* backend_; | 196 BackendImpl* backend_; |
192 LruData* control_data_; // Data related to the LRU lists. | 197 LruData* control_data_; // Data related to the LRU lists. |
193 IteratorList iterators_; | 198 IteratorList iterators_; |
194 | 199 |
195 DISALLOW_COPY_AND_ASSIGN(Rankings); | 200 DISALLOW_COPY_AND_ASSIGN(Rankings); |
196 }; | 201 }; |
197 | 202 |
198 } // namespace disk_cache | 203 } // namespace disk_cache |
199 | 204 |
200 #endif // NET_DISK_CACHE_RANKINGS_H_ | 205 #endif // NET_DISK_CACHE_RANKINGS_H_ |
OLD | NEW |