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