| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_H_ | 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_H_ |
| 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_H_ | 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_H_ |
| 7 | 7 |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/port.h" | 10 #include "base/port.h" |
| 11 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
| 12 | 12 |
| 13 namespace base { | 13 namespace base { |
| 14 class Time; | 14 class Time; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace disk_cache { | 17 namespace disk_cache { |
| 18 | 18 |
| 19 const uint64 kSimpleInitialMagicNumber = GG_UINT64_C(0xfcfb6d1ba7725c30); | 19 const uint64 kSimpleInitialMagicNumber = GG_UINT64_C(0xfcfb6d1ba7725c30); |
| 20 const uint64 kSimpleFinalMagicNumber = GG_UINT64_C(0xf4fa6f45970d41d8); | 20 const uint64 kSimpleFinalMagicNumber = GG_UINT64_C(0xf4fa6f45970d41d8); |
| 21 | 21 |
| 22 // A file in the Simple cache consists of a SimpleFileHeader followed | 22 // A file containing stream 0 and stream 1 in the Simple cache consists of: |
| 23 // by data. | 23 // - a SimpleFileHeader. |
| 24 // - the key. |
| 25 // - the data from stream 1. |
| 26 // - a SimpleFileEOF record for stream 1. |
| 27 // - the data from stream 0. |
| 28 // - a SimpleFileEOF record for stream 0. |
| 24 | 29 |
| 25 // A file in the Simple cache consists of: | 30 // A file containing stream 2 in the Simple cache consists of: |
| 26 // - a SimpleFileHeader. | 31 // - a SimpleFileHeader. |
| 27 // - the key. | 32 // - the key. |
| 28 // - the data. | 33 // - the data. |
| 29 // - at the end, a SimpleFileEOF record. | 34 // - at the end, a SimpleFileEOF record. |
| 30 const uint32 kSimpleVersion = 4; | 35 const uint32 kSimpleVersion = 5; |
| 31 | 36 |
| 32 static const int kSimpleEntryFileCount = 3; | 37 static const int kSimpleEntryFileCount = 2; |
| 38 static const int kSimpleEntryStreamCount = 3; |
| 33 | 39 |
| 34 struct NET_EXPORT_PRIVATE SimpleFileHeader { | 40 struct NET_EXPORT_PRIVATE SimpleFileHeader { |
| 35 SimpleFileHeader(); | 41 SimpleFileHeader(); |
| 36 | 42 |
| 37 uint64 initial_magic_number; | 43 uint64 initial_magic_number; |
| 38 uint32 version; | 44 uint32 version; |
| 39 uint32 key_length; | 45 uint32 key_length; |
| 40 uint32 key_hash; | 46 uint32 key_hash; |
| 41 }; | 47 }; |
| 42 | 48 |
| 43 struct SimpleFileEOF { | 49 struct SimpleFileEOF { |
| 44 enum Flags { | 50 enum Flags { |
| 45 FLAG_HAS_CRC32 = (1U << 0), | 51 FLAG_HAS_CRC32 = (1U << 0), |
| 46 }; | 52 }; |
| 47 | 53 |
| 48 SimpleFileEOF(); | 54 SimpleFileEOF(); |
| 49 | 55 |
| 50 uint64 final_magic_number; | 56 uint64 final_magic_number; |
| 51 uint32 flags; | 57 uint32 flags; |
| 52 uint32 data_crc32; | 58 uint32 data_crc32; |
| 59 // |stream_size| is only used in the EOF record for stream 0. |
| 60 uint32 stream_size; |
| 53 }; | 61 }; |
| 54 | 62 |
| 55 } // namespace disk_cache | 63 } // namespace disk_cache |
| 56 | 64 |
| 57 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_H_ | 65 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_H_ |
| OLD | NEW |