| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 (disk_cache/addr.h) will be stored in | 8 // Any data blob bigger than kMaxBlockSize (disk_cache/addr.h) will be stored in |
| 9 // a separate file named f_xxx where x is a hexadecimal number. Shorter data | 9 // a separate file named f_xxx where x is a hexadecimal number. Shorter data |
| 10 // will be stored as a series of blocks on a block-file. In any case, CacheAddr | 10 // will be stored as a series of blocks on a block-file. In any case, CacheAddr |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // | 35 // |
| 36 // In order to prevent dirty data to be used as valid (after a crash), every | 36 // In order to prevent dirty data to be used as valid (after a crash), every |
| 37 // cache entry has a dirty identifier. Each running instance of the cache keeps | 37 // cache entry has a dirty identifier. Each running instance of the cache keeps |
| 38 // a separate identifier (maintained on the "this_id" header field) that is used | 38 // a separate identifier (maintained on the "this_id" header field) that is used |
| 39 // to mark every entry that is created or modified. When the entry is closed, | 39 // to mark every entry that is created or modified. When the entry is closed, |
| 40 // and all the data can be trusted, the dirty flag is cleared from the entry. | 40 // and all the data can be trusted, the dirty flag is cleared from the entry. |
| 41 // When the cache encounters an entry whose identifier is different than the one | 41 // When the cache encounters an entry whose identifier is different than the one |
| 42 // being currently used, it means that the entry was not properly closed on a | 42 // being currently used, it means that the entry was not properly closed on a |
| 43 // previous run, so it is discarded. | 43 // previous run, so it is discarded. |
| 44 | 44 |
| 45 #ifndef NET_DISK_CACHE_DISK_FORMAT_H_ | 45 #ifndef NET_DISK_CACHE_V2_DISK_FORMAT_H_ |
| 46 #define NET_DISK_CACHE_DISK_FORMAT_H_ | 46 #define NET_DISK_CACHE_V2_DISK_FORMAT_H_ |
| 47 | 47 |
| 48 #include "base/basictypes.h" | 48 #include "base/basictypes.h" |
| 49 #include "net/base/net_export.h" | 49 #include "net/base/net_export.h" |
| 50 #include "net/disk_cache/disk_format_base.h" | 50 #include "net/disk_cache/v2/disk_format_base.h" |
| 51 | 51 |
| 52 namespace disk_cache { | 52 namespace disk_cache { |
| 53 | 53 |
| 54 const int kIndexTablesize = 0x10000; | 54 const int kIndexTablesize = 0x10000; |
| 55 const uint32 kIndexMagic = 0xC103CAC3; | 55 const uint32 kIndexMagic = 0xC103CAC3; |
| 56 const uint32 kCurrentVersion = 0x20000; // Version 2.0. | 56 const uint32 kCurrentVersion = 0x20000; // Version 2.0. |
| 57 | 57 |
| 58 struct LruData { | 58 struct LruData { |
| 59 int32 pad1[2]; | 59 int32 pad1[2]; |
| 60 int32 filled; // Flag to tell when we filled the cache. | 60 int32 filled; // Flag to tell when we filled the cache. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 CacheAddr contents; // Address of the EntryStore. | 143 CacheAddr contents; // Address of the EntryStore. |
| 144 int32 dirty; // The entry is being modifyied. | 144 int32 dirty; // The entry is being modifyied. |
| 145 uint32 self_hash; // RankingsNode's hash. | 145 uint32 self_hash; // RankingsNode's hash. |
| 146 }; | 146 }; |
| 147 #pragma pack(pop) | 147 #pragma pack(pop) |
| 148 | 148 |
| 149 COMPILE_ASSERT(sizeof(RankingsNode) == 36, bad_RankingsNode); | 149 COMPILE_ASSERT(sizeof(RankingsNode) == 36, bad_RankingsNode); |
| 150 | 150 |
| 151 } // namespace disk_cache | 151 } // namespace disk_cache |
| 152 | 152 |
| 153 #endif // NET_DISK_CACHE_DISK_FORMAT_H_ | 153 #endif // NET_DISK_CACHE_V2_DISK_FORMAT_H_ |
| OLD | NEW |