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

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, 8 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
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 |stop1| or |stop2| nodes are
180 // reached. Returns an error code (0 on success), the number of items verified
181 // and the addresses of the last nodes visited (|last2| was seen before
182 // |last1|).
183 int CheckListSection(List list, Addr stop1, Addr stop2, bool forward,
184 Addr* last1, Addr* last2, int* num_items);
185
183 // Returns true if addr is the head or tail of any list. When there is a 186 // 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|. 187 // match |list| will contain the list number for |addr|.
185 bool IsHead(CacheAddr addr, List* list) const; 188 bool IsHead(CacheAddr addr, List* list) const;
186 bool IsTail(CacheAddr addr, List* list) const; 189 bool IsTail(CacheAddr addr, List* list) const;
187 190
188 // Updates the iterators whenever node is being changed. 191 // Updates the iterators whenever node is being changed.
189 void UpdateIterators(CacheRankingsBlock* node); 192 void UpdateIterators(CacheRankingsBlock* node);
190 193
191 // Invalidates the iterators pointing to this node. 194 // Invalidates the iterators pointing to this node.
192 void InvalidateIterators(CacheRankingsBlock* node); 195 void InvalidateIterators(CacheRankingsBlock* node);
193 196
194 // Keeps track of the number of entries on a list. 197 // Keeps track of the number of entries on a list.
195 void IncrementCounter(List list); 198 void IncrementCounter(List list);
196 void DecrementCounter(List list); 199 void DecrementCounter(List list);
197 200
198 bool init_; 201 bool init_;
199 bool count_lists_; 202 bool count_lists_;
200 Addr heads_[LAST_ELEMENT]; 203 Addr heads_[LAST_ELEMENT];
201 Addr tails_[LAST_ELEMENT]; 204 Addr tails_[LAST_ELEMENT];
202 BackendImpl* backend_; 205 BackendImpl* backend_;
203 LruData* control_data_; // Data related to the LRU lists. 206 LruData* control_data_; // Data related to the LRU lists.
204 IteratorList iterators_; 207 IteratorList iterators_;
205 208
206 DISALLOW_COPY_AND_ASSIGN(Rankings); 209 DISALLOW_COPY_AND_ASSIGN(Rankings);
207 }; 210 };
208 211
209 } // namespace disk_cache 212 } // namespace disk_cache
210 213
211 #endif // NET_DISK_CACHE_RANKINGS_H_ 214 #endif // NET_DISK_CACHE_RANKINGS_H_
OLDNEW
« no previous file with comments | « net/disk_cache/errors.h ('k') | net/disk_cache/rankings.cc » ('j') | net/disk_cache/rankings.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698