OLD | NEW |
1 // Copyright (c) 2012 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 // This is an internal class that handles the address of a cache record. | 5 // This is an internal class that handles the address of a cache record. |
6 // See net/disk_cache/disk_cache.h for the public interface of the cache. | 6 // See net/disk_cache/disk_cache.h for the public interface of the cache. |
7 | 7 |
8 #ifndef NET_DISK_CACHE_BLOCKFILE_ADDR_H_ | 8 #ifndef NET_DISK_CACHE_BLOCKFILE_ADDR_H_ |
9 #define NET_DISK_CACHE_BLOCKFILE_ADDR_H_ | 9 #define NET_DISK_CACHE_BLOCKFILE_ADDR_H_ |
10 | 10 |
11 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
12 #include "net/disk_cache/blockfile/disk_format_base.h" | 12 #include "net/disk_cache/blockfile/disk_format_base.h" |
13 | 13 |
14 namespace disk_cache { | 14 namespace disk_cache { |
15 | 15 |
16 enum FileType { | 16 enum FileType { |
17 EXTERNAL = 0, | 17 EXTERNAL = 0, |
18 RANKINGS = 1, | 18 RANKINGS = 1, |
19 BLOCK_256 = 2, | 19 BLOCK_256 = 2, |
20 BLOCK_1K = 3, | 20 BLOCK_1K = 3, |
21 BLOCK_4K = 4, | 21 BLOCK_4K = 4, |
22 BLOCK_FILES = 5, | 22 BLOCK_FILES = 5, |
23 BLOCK_ENTRIES = 6, | 23 BLOCK_ENTRIES = 6, |
24 BLOCK_EVICTED = 7 | 24 BLOCK_EVICTED = 7 |
25 }; | 25 }; |
26 | 26 |
27 const int kMaxBlockSize = 4096 * 4; | 27 const int kMaxBlockSize = 4096 * 4; |
28 const int kMaxBlockFile = 255; | 28 const int16 kMaxBlockFile = 255; |
29 const int kMaxNumBlocks = 4; | 29 const int kMaxNumBlocks = 4; |
30 const int kFirstAdditionalBlockFile = 4; | 30 const int16 kFirstAdditionalBlockFile = 4; |
31 const int kFirstAdditionalBlockFileV3 = 7; | 31 const size_t kFirstAdditionalBlockFileV3 = 7; |
32 | 32 |
33 // Defines a storage address for a cache record | 33 // Defines a storage address for a cache record |
34 // | 34 // |
35 // Header: | 35 // Header: |
36 // 1000 0000 0000 0000 0000 0000 0000 0000 : initialized bit | 36 // 1000 0000 0000 0000 0000 0000 0000 0000 : initialized bit |
37 // 0111 0000 0000 0000 0000 0000 0000 0000 : file type | 37 // 0111 0000 0000 0000 0000 0000 0000 0000 : file type |
38 // | 38 // |
39 // File type values: | 39 // File type values: |
40 // 0 = separate file on disk | 40 // 0 = separate file on disk |
41 // 1 = rankings block file | 41 // 1 = rankings block file |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 static const uint32 kFileSelectorOffset = 16; | 179 static const uint32 kFileSelectorOffset = 16; |
180 static const uint32 kStartBlockMask = 0x0000FFFF; | 180 static const uint32 kStartBlockMask = 0x0000FFFF; |
181 static const uint32 kFileNameMask = 0x0FFFFFFF; | 181 static const uint32 kFileNameMask = 0x0FFFFFFF; |
182 | 182 |
183 CacheAddr value_; | 183 CacheAddr value_; |
184 }; | 184 }; |
185 | 185 |
186 } // namespace disk_cache | 186 } // namespace disk_cache |
187 | 187 |
188 #endif // NET_DISK_CACHE_BLOCKFILE_ADDR_H_ | 188 #endif // NET_DISK_CACHE_BLOCKFILE_ADDR_H_ |
OLD | NEW |