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

Side by Side Diff: net/disk_cache/rankings.h

Issue 10148001: Disk Cache: Add more corruption tracking histograms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 | « net/disk_cache/errors.h ('k') | net/disk_cache/rankings.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #pragma once 9 #pragma once
10 10
11 #include <list> 11 #include <list>
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 bool GetRanking(CacheRankingsBlock* rankings); 157 bool GetRanking(CacheRankingsBlock* rankings);
158 158
159 // Makes |rankings| suitable to live a long life. 159 // Makes |rankings| suitable to live a long life.
160 void ConvertToLongLived(CacheRankingsBlock* rankings); 160 void ConvertToLongLived(CacheRankingsBlock* rankings);
161 161
162 // Finishes a list modification after a crash. 162 // Finishes a list modification after a crash.
163 void CompleteTransaction(); 163 void CompleteTransaction();
164 void FinishInsert(CacheRankingsBlock* rankings); 164 void FinishInsert(CacheRankingsBlock* rankings);
165 void RevertRemove(CacheRankingsBlock* rankings); 165 void RevertRemove(CacheRankingsBlock* rankings);
166 166
167 // Returns false if this entry will not be recognized as dirty (called during
168 // selfcheck).
169 bool CheckEntry(CacheRankingsBlock* rankings);
170
171 // Returns false if node is not properly linked. This method may change the 167 // Returns false if node is not properly linked. This method may change the
172 // provided |list| to reflect the list where this node is actually stored. 168 // provided |list| to reflect the list where this node is actually stored.
173 bool CheckLinks(CacheRankingsBlock* node, CacheRankingsBlock* prev, 169 bool CheckLinks(CacheRankingsBlock* node, CacheRankingsBlock* prev,
174 CacheRankingsBlock* next, List* list); 170 CacheRankingsBlock* next, List* list);
175 171
176 // Checks the links between two consecutive nodes. 172 // Checks the links between two consecutive nodes.
177 bool CheckSingleLink(CacheRankingsBlock* prev, CacheRankingsBlock* next); 173 bool CheckSingleLink(CacheRankingsBlock* prev, CacheRankingsBlock* next);
178 174
179 // Peforms a simple check of the list, and returns the number of items or an 175 // Peforms a simple check of the list, and returns the number of items or an
180 // error code (negative value). 176 // error code (negative value).
181 int CheckList(List list); 177 int CheckList(List list);
182 178
179 // Walks a list in the desired direction until the nodes |end1| or |end2| are
180 // reached. Returns an error code (0 on success), the number of items verified
181 // and the addresses of the last nodes visited.
182 int CheckListSection(List list, Addr end1, Addr end2, bool forward,
183 Addr* last, Addr* second_last, int* num_items);
184
183 // Returns true if addr is the head or tail of any list. When there is a 185 // Returns true if addr is the head or tail of any list. When there is a
184 // match |list| will contain the list number for |addr|. 186 // match |list| will contain the list number for |addr|.
185 bool IsHead(CacheAddr addr, List* list) const; 187 bool IsHead(CacheAddr addr, List* list) const;
186 bool IsTail(CacheAddr addr, List* list) const; 188 bool IsTail(CacheAddr addr, List* list) const;
187 189
188 // Updates the iterators whenever node is being changed. 190 // Updates the iterators whenever node is being changed.
189 void UpdateIterators(CacheRankingsBlock* node); 191 void UpdateIterators(CacheRankingsBlock* node);
190 192
191 // Invalidates the iterators pointing to this node. 193 // Invalidates the iterators pointing to this node.
192 void InvalidateIterators(CacheRankingsBlock* node); 194 void InvalidateIterators(CacheRankingsBlock* node);
193 195
194 // Keeps track of the number of entries on a list. 196 // Keeps track of the number of entries on a list.
195 void IncrementCounter(List list); 197 void IncrementCounter(List list);
196 void DecrementCounter(List list); 198 void DecrementCounter(List list);
197 199
198 bool init_; 200 bool init_;
199 bool count_lists_; 201 bool count_lists_;
200 Addr heads_[LAST_ELEMENT]; 202 Addr heads_[LAST_ELEMENT];
201 Addr tails_[LAST_ELEMENT]; 203 Addr tails_[LAST_ELEMENT];
202 BackendImpl* backend_; 204 BackendImpl* backend_;
203 LruData* control_data_; // Data related to the LRU lists. 205 LruData* control_data_; // Data related to the LRU lists.
204 IteratorList iterators_; 206 IteratorList iterators_;
205 207
206 DISALLOW_COPY_AND_ASSIGN(Rankings); 208 DISALLOW_COPY_AND_ASSIGN(Rankings);
207 }; 209 };
208 210
209 } // namespace disk_cache 211 } // namespace disk_cache
210 212
211 #endif // NET_DISK_CACHE_RANKINGS_H_ 213 #endif // NET_DISK_CACHE_RANKINGS_H_
OLDNEW
« no previous file with comments | « net/disk_cache/errors.h ('k') | net/disk_cache/rankings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698