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

Side by Side Diff: net/disk_cache/blockfile/index_table_v3.h

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_BLOCKFILE_INDEX_TABLE_V3_H_ 5 #ifndef NET_DISK_CACHE_BLOCKFILE_INDEX_TABLE_V3_H_
6 #define NET_DISK_CACHE_BLOCKFILE_INDEX_TABLE_V3_H_ 6 #define NET_DISK_CACHE_BLOCKFILE_INDEX_TABLE_V3_H_
7 7
8 // The IndexTable class is in charge of handling all the details about the main 8 // The IndexTable class is in charge of handling all the details about the main
9 // index table of the cache. It provides methods to locate entries in the cache, 9 // index table of the cache. It provides methods to locate entries in the cache,
10 // create new entries and modify existing entries. It hides the fact that the 10 // create new entries and modify existing entries. It hides the fact that the
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 EntrySet(); 109 EntrySet();
110 ~EntrySet(); 110 ~EntrySet();
111 111
112 int evicted_count; // The numebr of evicted entries in this set. 112 int evicted_count; // The numebr of evicted entries in this set.
113 size_t current; // The number of the cell that is being processed. 113 size_t current; // The number of the cell that is being processed.
114 std::vector<EntryCell> cells; 114 std::vector<EntryCell> cells;
115 }; 115 };
116 116
117 // A given entity referenced by the index table is uniquely identified by the 117 // A given entity referenced by the index table is uniquely identified by the
118 // combination of hash and address. 118 // combination of hash and address.
119 struct CellInfo { uint32 hash; Addr address; }; 119 struct CellInfo {
120 uint32 hash;
121 Addr address;
122 };
120 typedef std::vector<CellInfo> CellList; 123 typedef std::vector<CellInfo> CellList;
121 124
122 // An index iterator is used to get a group of cells that share the same 125 // An index iterator is used to get a group of cells that share the same
123 // timestamp. When this structure is passed to GetNextCells(), the caller sets 126 // timestamp. When this structure is passed to GetNextCells(), the caller sets
124 // the initial timestamp and direction; whet it is used with GetOldest, the 127 // the initial timestamp and direction; whet it is used with GetOldest, the
125 // initial values are ignored. 128 // initial values are ignored.
126 struct NET_EXPORT_PRIVATE IndexIterator { 129 struct NET_EXPORT_PRIVATE IndexIterator {
127 IndexIterator(); 130 IndexIterator();
128 ~IndexIterator(); 131 ~IndexIterator();
129 132
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 236
234 private: 237 private:
235 EntryCell FindEntryCellImpl(uint32 hash, Addr address, bool allow_deleted); 238 EntryCell FindEntryCellImpl(uint32 hash, Addr address, bool allow_deleted);
236 void CheckState(const EntryCell& cell); 239 void CheckState(const EntryCell& cell);
237 void Write(const EntryCell& cell); 240 void Write(const EntryCell& cell);
238 int NewExtraBucket(); 241 int NewExtraBucket();
239 void WalkTables(int limit_time, 242 void WalkTables(int limit_time,
240 IndexIterator* no_use, 243 IndexIterator* no_use,
241 IndexIterator* low_use, 244 IndexIterator* low_use,
242 IndexIterator* high_use); 245 IndexIterator* high_use);
243 void UpdateFromBucket(IndexBucket* bucket, int bucket_hash, 246 void UpdateFromBucket(IndexBucket* bucket,
247 int bucket_hash,
244 int limit_time, 248 int limit_time,
245 IndexIterator* no_use, 249 IndexIterator* no_use,
246 IndexIterator* low_use, 250 IndexIterator* low_use,
247 IndexIterator* high_use); 251 IndexIterator* high_use);
248 void MoveCells(IndexBucket* old_extra_table); 252 void MoveCells(IndexBucket* old_extra_table);
249 void MoveSingleCell(IndexCell* current_cell, int cell_num, 253 void MoveSingleCell(IndexCell* current_cell,
250 int main_table_index, bool growing); 254 int cell_num,
251 void HandleMisplacedCell(IndexCell* current_cell, int cell_num, 255 int main_table_index,
256 bool growing);
257 void HandleMisplacedCell(IndexCell* current_cell,
258 int cell_num,
252 int main_table_index); 259 int main_table_index);
253 void CheckBucketList(int bucket_id); 260 void CheckBucketList(int bucket_id);
254 261
255 uint32 GetLocation(const IndexCell& cell); 262 uint32 GetLocation(const IndexCell& cell);
256 uint32 GetHashValue(const IndexCell& cell); 263 uint32 GetHashValue(const IndexCell& cell);
257 uint32 GetFullHash(const IndexCell& cell, uint32 lower_part); 264 uint32 GetFullHash(const IndexCell& cell, uint32 lower_part);
258 bool IsHashMatch(const IndexCell& cell, uint32 hash); 265 bool IsHashMatch(const IndexCell& cell, uint32 hash);
259 bool MisplacedHash(const IndexCell& cell, uint32 hash); 266 bool MisplacedHash(const IndexCell& cell, uint32 hash);
260 267
261 IndexTableBackend* backend_; 268 IndexTableBackend* backend_;
262 IndexHeaderV3* header_; 269 IndexHeaderV3* header_;
263 scoped_ptr<Bitmap> bitmap_; 270 scoped_ptr<Bitmap> bitmap_;
264 scoped_ptr<Bitmap> backup_bitmap_; 271 scoped_ptr<Bitmap> backup_bitmap_;
265 scoped_ptr<uint32[]> backup_bitmap_storage_; 272 scoped_ptr<uint32[]> backup_bitmap_storage_;
266 scoped_ptr<IndexHeaderV3> backup_header_; 273 scoped_ptr<IndexHeaderV3> backup_header_;
267 IndexBucket* main_table_; 274 IndexBucket* main_table_;
268 IndexBucket* extra_table_; 275 IndexBucket* extra_table_;
269 uint32 mask_; // Binary mask to map a hash to the hash table. 276 uint32 mask_; // Binary mask to map a hash to the hash table.
270 int extra_bits_; // How many bits are in mask_ above the default value. 277 int extra_bits_; // How many bits are in mask_ above the default value.
271 bool modified_; 278 bool modified_;
272 bool small_table_; 279 bool small_table_;
273 280
274 DISALLOW_COPY_AND_ASSIGN(IndexTable); 281 DISALLOW_COPY_AND_ASSIGN(IndexTable);
275 }; 282 };
276 283
277 } // namespace disk_cache 284 } // namespace disk_cache
278 285
279 #endif // NET_DISK_CACHE_BLOCKFILE_INDEX_TABLE_V3_H_ 286 #endif // NET_DISK_CACHE_BLOCKFILE_INDEX_TABLE_V3_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698