| 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 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | |
| 11 #include "net/base/net_export.h" | 10 #include "net/base/net_export.h" |
| 12 | 11 |
| 13 namespace base { | 12 namespace base { |
| 14 class Time; | 13 class Time; |
| 15 } | 14 } |
| 16 | 15 |
| 17 namespace disk_cache { | 16 namespace disk_cache { |
| 18 | 17 |
| 19 const uint64 kSimpleInitialMagicNumber = UINT64_C(0xfcfb6d1ba7725c30); | 18 const uint64_t kSimpleInitialMagicNumber = UINT64_C(0xfcfb6d1ba7725c30); |
| 20 const uint64 kSimpleFinalMagicNumber = UINT64_C(0xf4fa6f45970d41d8); | 19 const uint64_t kSimpleFinalMagicNumber = UINT64_C(0xf4fa6f45970d41d8); |
| 21 const uint64 kSimpleSparseRangeMagicNumber = UINT64_C(0xeb97bf016553676b); | 20 const uint64_t kSimpleSparseRangeMagicNumber = UINT64_C(0xeb97bf016553676b); |
| 22 | 21 |
| 23 // A file containing stream 0 and stream 1 in the Simple cache consists of: | 22 // A file containing stream 0 and stream 1 in the Simple cache consists of: |
| 24 // - a SimpleFileHeader. | 23 // - a SimpleFileHeader. |
| 25 // - the key. | 24 // - the key. |
| 26 // - the data from stream 1. | 25 // - the data from stream 1. |
| 27 // - a SimpleFileEOF record for stream 1. | 26 // - a SimpleFileEOF record for stream 1. |
| 28 // - the data from stream 0. | 27 // - the data from stream 0. |
| 29 // - a SimpleFileEOF record for stream 0. | 28 // - a SimpleFileEOF record for stream 0. |
| 30 | 29 |
| 31 // A file containing stream 2 in the Simple cache consists of: | 30 // A file containing stream 2 in the Simple cache consists of: |
| 32 // - a SimpleFileHeader. | 31 // - a SimpleFileHeader. |
| 33 // - the key. | 32 // - the key. |
| 34 // - the data. | 33 // - the data. |
| 35 // - at the end, a SimpleFileEOF record. | 34 // - at the end, a SimpleFileEOF record. |
| 36 static const int kSimpleEntryFileCount = 2; | 35 static const int kSimpleEntryFileCount = 2; |
| 37 static const int kSimpleEntryStreamCount = 3; | 36 static const int kSimpleEntryStreamCount = 3; |
| 38 | 37 |
| 39 struct NET_EXPORT_PRIVATE SimpleFileHeader { | 38 struct NET_EXPORT_PRIVATE SimpleFileHeader { |
| 40 SimpleFileHeader(); | 39 SimpleFileHeader(); |
| 41 | 40 |
| 42 uint64 initial_magic_number; | 41 uint64_t initial_magic_number; |
| 43 uint32 version; | 42 uint32_t version; |
| 44 uint32 key_length; | 43 uint32_t key_length; |
| 45 uint32 key_hash; | 44 uint32_t key_hash; |
| 46 }; | 45 }; |
| 47 | 46 |
| 48 struct NET_EXPORT_PRIVATE SimpleFileEOF { | 47 struct NET_EXPORT_PRIVATE SimpleFileEOF { |
| 49 enum Flags { | 48 enum Flags { |
| 50 FLAG_HAS_CRC32 = (1U << 0), | 49 FLAG_HAS_CRC32 = (1U << 0), |
| 51 }; | 50 }; |
| 52 | 51 |
| 53 SimpleFileEOF(); | 52 SimpleFileEOF(); |
| 54 | 53 |
| 55 uint64 final_magic_number; | 54 uint64_t final_magic_number; |
| 56 uint32 flags; | 55 uint32_t flags; |
| 57 uint32 data_crc32; | 56 uint32_t data_crc32; |
| 58 // |stream_size| is only used in the EOF record for stream 0. | 57 // |stream_size| is only used in the EOF record for stream 0. |
| 59 uint32 stream_size; | 58 uint32_t stream_size; |
| 60 }; | 59 }; |
| 61 | 60 |
| 62 struct SimpleFileSparseRangeHeader { | 61 struct SimpleFileSparseRangeHeader { |
| 63 SimpleFileSparseRangeHeader(); | 62 SimpleFileSparseRangeHeader(); |
| 64 | 63 |
| 65 uint64 sparse_range_magic_number; | 64 uint64_t sparse_range_magic_number; |
| 66 int64 offset; | 65 int64_t offset; |
| 67 int64 length; | 66 int64_t length; |
| 68 uint32 data_crc32; | 67 uint32_t data_crc32; |
| 69 }; | 68 }; |
| 70 | 69 |
| 71 } // namespace disk_cache | 70 } // namespace disk_cache |
| 72 | 71 |
| 73 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_H_ | 72 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_H_ |
| OLD | NEW |