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

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

Issue 149306: Disk cache: Add explicit support for eviction / deletion... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 5 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/block_files.cc ('k') | net/disk_cache/entry_impl.h » ('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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 CacheAddr next; // Next entry with the same hash or bucket. 116 CacheAddr next; // Next entry with the same hash or bucket.
117 CacheAddr rankings_node; // Rankings node for this entry. 117 CacheAddr rankings_node; // Rankings node for this entry.
118 int32 reuse_count; // How often is this entry used. 118 int32 reuse_count; // How often is this entry used.
119 int32 refetch_count; // How often is this fetched from the net. 119 int32 refetch_count; // How often is this fetched from the net.
120 int32 state; // Current state. 120 int32 state; // Current state.
121 uint64 creation_time; 121 uint64 creation_time;
122 int32 key_len; 122 int32 key_len;
123 CacheAddr long_key; // Optional address of a long key. 123 CacheAddr long_key; // Optional address of a long key.
124 int32 data_size[4]; // We can store up to 4 data streams for each 124 int32 data_size[4]; // We can store up to 4 data streams for each
125 CacheAddr data_addr[4]; // entry. 125 CacheAddr data_addr[4]; // entry.
126 int32 pad[6]; 126 uint32 flags; // Any combination of EntryFlags.
127 int32 pad[5];
127 char key[256 - 24 * 4]; // null terminated 128 char key[256 - 24 * 4]; // null terminated
128 }; 129 };
129 130
130 COMPILE_ASSERT(sizeof(EntryStore) == 256, bad_EntyStore); 131 COMPILE_ASSERT(sizeof(EntryStore) == 256, bad_EntyStore);
131 const int kMaxInternalKeyLength = 4 * sizeof(EntryStore) - 132 const int kMaxInternalKeyLength = 4 * sizeof(EntryStore) -
132 offsetof(EntryStore, key) - 1; 133 offsetof(EntryStore, key) - 1;
133 134
134 // Possible states for a given entry. 135 // Possible states for a given entry.
135 enum EntryState { 136 enum EntryState {
136 ENTRY_NORMAL = 0, 137 ENTRY_NORMAL = 0,
137 ENTRY_EVICTED, // The entry was recently evicted from the cache. 138 ENTRY_EVICTED, // The entry was recently evicted from the cache.
138 ENTRY_DOOMED // The entry was doomed. 139 ENTRY_DOOMED // The entry was doomed.
139 }; 140 };
140 141
142 // Flags that can be applied to an entry.
143 enum EntryFlags {
144 PARENT_ENTRY = 1, // This entry has children (sparse) entries.
145 CHILD_ENTRY = 1 << 1 // Child entry that stores sparse data.
146 };
147
141 #pragma pack(push, 4) 148 #pragma pack(push, 4)
142 // Rankings information for a given entry. 149 // Rankings information for a given entry.
143 struct RankingsNode { 150 struct RankingsNode {
144 uint64 last_used; // LRU info. 151 uint64 last_used; // LRU info.
145 uint64 last_modified; // LRU info. 152 uint64 last_modified; // LRU info.
146 CacheAddr next; // LRU list. 153 CacheAddr next; // LRU list.
147 CacheAddr prev; // LRU list. 154 CacheAddr prev; // LRU list.
148 CacheAddr contents; // Address of the EntryStore. 155 CacheAddr contents; // Address of the EntryStore.
149 int32 dirty; // The entry is being modifyied. 156 int32 dirty; // The entry is being modifyied.
150 void* pointer; // Pointer to the in-memory entry. 157 void* pointer; // Pointer to the in-memory entry.
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 }; 252 };
246 253
247 // The number of blocks stored by a child entry. 254 // The number of blocks stored by a child entry.
248 const int kNumSparseBits = 1024; 255 const int kNumSparseBits = 1024;
249 COMPILE_ASSERT(sizeof(SparseData) == sizeof(SparseHeader) + kNumSparseBits / 8, 256 COMPILE_ASSERT(sizeof(SparseData) == sizeof(SparseHeader) + kNumSparseBits / 8,
250 Invalid_SparseData_bitmap); 257 Invalid_SparseData_bitmap);
251 258
252 } // namespace disk_cache 259 } // namespace disk_cache
253 260
254 #endif // NET_DISK_CACHE_DISK_FORMAT_H_ 261 #endif // NET_DISK_CACHE_DISK_FORMAT_H_
OLDNEW
« no previous file with comments | « net/disk_cache/block_files.cc ('k') | net/disk_cache/entry_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698