OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 // The cache is stored on disk as a collection of block-files, plus an index | 5 // The cache is stored on disk as a collection of block-files, plus an index |
6 // file plus a collection of external files. | 6 // file plus a collection of external files. |
7 // | 7 // |
8 // Any data blob bigger than kMaxBlockSize (net/addr.h) will be stored on a | 8 // Any data blob bigger than kMaxBlockSize (net/addr.h) will be stored on a |
9 // separate file named f_xxx where x is a hexadecimal number. Shorter data will | 9 // separate file named f_xxx where x is a hexadecimal number. Shorter data will |
10 // be stored as a series of blocks on a block-file. In any case, CacheAddr | 10 // be stored as a series of blocks on a block-file. In any case, CacheAddr |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 147 |
148 #pragma pack(push, 4) | 148 #pragma pack(push, 4) |
149 // Rankings information for a given entry. | 149 // Rankings information for a given entry. |
150 struct RankingsNode { | 150 struct RankingsNode { |
151 uint64 last_used; // LRU info. | 151 uint64 last_used; // LRU info. |
152 uint64 last_modified; // LRU info. | 152 uint64 last_modified; // LRU info. |
153 CacheAddr next; // LRU list. | 153 CacheAddr next; // LRU list. |
154 CacheAddr prev; // LRU list. | 154 CacheAddr prev; // LRU list. |
155 CacheAddr contents; // Address of the EntryStore. | 155 CacheAddr contents; // Address of the EntryStore. |
156 int32 dirty; // The entry is being modifyied. | 156 int32 dirty; // The entry is being modifyied. |
157 void* pointer; // Pointer to the in-memory entry. | 157 int32 dummy; // Old files may have a pointer here. |
158 }; | 158 }; |
159 #pragma pack(pop) | 159 #pragma pack(pop) |
160 | 160 |
161 COMPILE_ASSERT(sizeof(RankingsNode) == 36, bad_RankingsNode); | 161 COMPILE_ASSERT(sizeof(RankingsNode) == 36, bad_RankingsNode); |
162 | 162 |
163 const uint32 kBlockMagic = 0xC104CAC3; | 163 const uint32 kBlockMagic = 0xC104CAC3; |
164 const int kBlockHeaderSize = 8192; // Two pages: almost 64k entries | 164 const int kBlockHeaderSize = 8192; // Two pages: almost 64k entries |
165 const int kMaxBlocks = (kBlockHeaderSize - 80) * 8; | 165 const int kMaxBlocks = (kBlockHeaderSize - 80) * 8; |
166 | 166 |
167 // Bitmap to track used blocks on a block-file. | 167 // Bitmap to track used blocks on a block-file. |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 }; | 257 }; |
258 | 258 |
259 // The number of blocks stored by a child entry. | 259 // The number of blocks stored by a child entry. |
260 const int kNumSparseBits = 1024; | 260 const int kNumSparseBits = 1024; |
261 COMPILE_ASSERT(sizeof(SparseData) == sizeof(SparseHeader) + kNumSparseBits / 8, | 261 COMPILE_ASSERT(sizeof(SparseData) == sizeof(SparseHeader) + kNumSparseBits / 8, |
262 Invalid_SparseData_bitmap); | 262 Invalid_SparseData_bitmap); |
263 | 263 |
264 } // namespace disk_cache | 264 } // namespace disk_cache |
265 | 265 |
266 #endif // NET_DISK_CACHE_DISK_FORMAT_H_ | 266 #endif // NET_DISK_CACHE_DISK_FORMAT_H_ |
OLD | NEW |