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

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

Issue 3814013: FBTF: Monster ctor patch after changing heuristics in clang plugin. (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: More add file fail Created 10 years, 2 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 | « media/media.gyp ('k') | net/disk_cache/disk_format.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) 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 CacheAddr heads[5]; 73 CacheAddr heads[5];
74 CacheAddr tails[5]; 74 CacheAddr tails[5];
75 CacheAddr transaction; // In-flight operation target. 75 CacheAddr transaction; // In-flight operation target.
76 int32 operation; // Actual in-flight operation. 76 int32 operation; // Actual in-flight operation.
77 int32 operation_list; // In-flight operation list. 77 int32 operation_list; // In-flight operation list.
78 int32 pad2[7]; 78 int32 pad2[7];
79 }; 79 };
80 80
81 // Header for the master index file. 81 // Header for the master index file.
82 struct IndexHeader { 82 struct IndexHeader {
83 IndexHeader();
84
83 uint32 magic; 85 uint32 magic;
84 uint32 version; 86 uint32 version;
85 int32 num_entries; // Number of entries currently stored. 87 int32 num_entries; // Number of entries currently stored.
86 int32 num_bytes; // Total size of the stored data. 88 int32 num_bytes; // Total size of the stored data.
87 int32 last_file; // Last external file created. 89 int32 last_file; // Last external file created.
88 int32 this_id; // Id for all entries being changed (dirty flag). 90 int32 this_id; // Id for all entries being changed (dirty flag).
89 CacheAddr stats; // Storage for usage data. 91 CacheAddr stats; // Storage for usage data.
90 int32 table_len; // Actual size of the table (0 == kIndexTablesize). 92 int32 table_len; // Actual size of the table (0 == kIndexTablesize).
91 int32 crash; // Signals a previous crash. 93 int32 crash; // Signals a previous crash.
92 int32 experiment; // Id of an ongoing test. 94 int32 experiment; // Id of an ongoing test.
93 uint64 create_time; // Creation time for this set of files. 95 uint64 create_time; // Creation time for this set of files.
94 int32 pad[52]; 96 int32 pad[52];
95 LruData lru; // Eviction control data. 97 LruData lru; // Eviction control data.
96 IndexHeader() {
97 memset(this, 0, sizeof(*this));
98 magic = kIndexMagic;
99 version = kCurrentVersion;
100 };
101 }; 98 };
102 99
103 // The structure of the whole index file. 100 // The structure of the whole index file.
104 struct Index { 101 struct Index {
105 IndexHeader header; 102 IndexHeader header;
106 CacheAddr table[kIndexTablesize]; // Default size. Actual size controlled 103 CacheAddr table[kIndexTablesize]; // Default size. Actual size controlled
107 // by header.table_len. 104 // by header.table_len.
108 }; 105 };
109 106
110 // Main structure for an entry on the backing storage. If the key is longer than 107 // Main structure for an entry on the backing storage. If the key is longer than
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 167
171 // A block-file is the file used to store information in blocks (could be 168 // A block-file is the file used to store information in blocks (could be
172 // EntryStore blocks, RankingsNode blocks or user-data blocks). 169 // EntryStore blocks, RankingsNode blocks or user-data blocks).
173 // We store entries that can expand for up to 4 consecutive blocks, and keep 170 // We store entries that can expand for up to 4 consecutive blocks, and keep
174 // counters of the number of blocks available for each type of entry. For 171 // counters of the number of blocks available for each type of entry. For
175 // instance, an entry of 3 blocks is an entry of type 3. We also keep track of 172 // instance, an entry of 3 blocks is an entry of type 3. We also keep track of
176 // where did we find the last entry of that type (to avoid searching the bitmap 173 // where did we find the last entry of that type (to avoid searching the bitmap
177 // from the beginning every time). 174 // from the beginning every time).
178 // This Structure is the header of a block-file: 175 // This Structure is the header of a block-file:
179 struct BlockFileHeader { 176 struct BlockFileHeader {
177 BlockFileHeader();
178
180 uint32 magic; 179 uint32 magic;
181 uint32 version; 180 uint32 version;
182 int16 this_file; // Index of this file. 181 int16 this_file; // Index of this file.
183 int16 next_file; // Next file when this one is full. 182 int16 next_file; // Next file when this one is full.
184 int32 entry_size; // Size of the blocks of this file. 183 int32 entry_size; // Size of the blocks of this file.
185 int32 num_entries; // Number of stored entries. 184 int32 num_entries; // Number of stored entries.
186 int32 max_entries; // Current maximum number of entries. 185 int32 max_entries; // Current maximum number of entries.
187 int32 empty[4]; // Counters of empty entries for each type. 186 int32 empty[4]; // Counters of empty entries for each type.
188 int32 hints[4]; // Last used position for each entry type. 187 int32 hints[4]; // Last used position for each entry type.
189 volatile int32 updating; // Keep track of updates to the header. 188 volatile int32 updating; // Keep track of updates to the header.
190 int32 user[5]; 189 int32 user[5];
191 AllocBitmap allocation_map; 190 AllocBitmap allocation_map;
192 BlockFileHeader() {
193 memset(this, 0, sizeof(BlockFileHeader));
194 magic = kBlockMagic;
195 version = kCurrentVersion;
196 };
197 }; 191 };
198 192
199 COMPILE_ASSERT(sizeof(BlockFileHeader) == kBlockHeaderSize, bad_header); 193 COMPILE_ASSERT(sizeof(BlockFileHeader) == kBlockHeaderSize, bad_header);
200 194
201 // Sparse data support: 195 // Sparse data support:
202 // We keep a two level hierarchy to enable sparse data for an entry: the first 196 // We keep a two level hierarchy to enable sparse data for an entry: the first
203 // level consists of using separate "child" entries to store ranges of 1 MB, 197 // level consists of using separate "child" entries to store ranges of 1 MB,
204 // and the second level stores blocks of 1 KB inside each child entry. 198 // and the second level stores blocks of 1 KB inside each child entry.
205 // 199 //
206 // Whenever we need to access a particular sparse offset, we first locate the 200 // Whenever we need to access a particular sparse offset, we first locate the
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 }; 252 };
259 253
260 // The number of blocks stored by a child entry. 254 // The number of blocks stored by a child entry.
261 const int kNumSparseBits = 1024; 255 const int kNumSparseBits = 1024;
262 COMPILE_ASSERT(sizeof(SparseData) == sizeof(SparseHeader) + kNumSparseBits / 8, 256 COMPILE_ASSERT(sizeof(SparseData) == sizeof(SparseHeader) + kNumSparseBits / 8,
263 Invalid_SparseData_bitmap); 257 Invalid_SparseData_bitmap);
264 258
265 } // namespace disk_cache 259 } // namespace disk_cache
266 260
267 #endif // NET_DISK_CACHE_DISK_FORMAT_H_ 261 #endif // NET_DISK_CACHE_DISK_FORMAT_H_
OLDNEW
« no previous file with comments | « media/media.gyp ('k') | net/disk_cache/disk_format.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698