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_UTIL_H_ | 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_UTIL_H_ |
6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_UTIL_H_ | 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 | 49 |
50 // Given the size of a file holding a stream in the simple backend and the key | 50 // Given the size of a file holding a stream in the simple backend and the key |
51 // to an entry, returns the number of bytes in the stream. | 51 // to an entry, returns the number of bytes in the stream. |
52 NET_EXPORT_PRIVATE int32 GetDataSizeFromKeyAndFileSize(const std::string& key, | 52 NET_EXPORT_PRIVATE int32 GetDataSizeFromKeyAndFileSize(const std::string& key, |
53 int64 file_size); | 53 int64 file_size); |
54 | 54 |
55 // Given the size of a stream in the simple backend and the key to an entry, | 55 // Given the size of a stream in the simple backend and the key to an entry, |
56 // returns the number of bytes in the file. | 56 // returns the number of bytes in the file. |
57 NET_EXPORT_PRIVATE int64 GetFileSizeFromKeyAndDataSize(const std::string& key, | 57 NET_EXPORT_PRIVATE int64 GetFileSizeFromKeyAndDataSize(const std::string& key, |
58 int32 data_size); | 58 int32 data_size); |
59 // Given the stream index, returns the number of the file the stream is stored | |
60 // in. | |
61 NET_EXPORT_PRIVATE int GetFileIndexFromStreamIndex(int stream_index); | |
62 | |
63 // Given the data size for all streams and a file index, gives the offset of the | |
64 // last EOF record. | |
65 NET_EXPORT_PRIVATE int GetLastEOFRecordOffset(int file_index, | |
66 const int data_size[]); | |
59 | 67 |
60 // Given the key to an entry, and an offset into a stream on that entry, returns | 68 // Given the key to an entry, and an offset into a stream on that entry, returns |
61 // the file offset corresponding to |data_offset|. | 69 // the file offset corresponding to |data_offset|. |
62 NET_EXPORT_PRIVATE int64 GetFileOffsetFromKeyAndDataOffset( | 70 NET_EXPORT_PRIVATE int64 GetFileOffsetFromDataOffset(const std::string& key, |
63 const std::string& key, | 71 int data_offset, |
64 int data_offset); | 72 int index, |
73 int stream_1_size); | |
pasko
2013/09/17 11:29:01
Originally I did not like this stream_1_size in th
clamy
2013/09/17 13:59:42
Done.
| |
65 | 74 |
66 // Fills |out_time| with the time the file last modified time. Unlike the | 75 // Fills |out_time| with the time the file last modified time. Unlike the |
67 // functions in platform_file.h, the time resolution is milliseconds. | 76 // functions in platform_file.h, the time resolution is milliseconds. |
68 NET_EXPORT_PRIVATE bool GetMTime(const base::FilePath& path, | 77 NET_EXPORT_PRIVATE bool GetMTime(const base::FilePath& path, |
69 base::Time* out_mtime); | 78 base::Time* out_mtime); |
70 } // namespace simple_backend | 79 } // namespace simple_backend |
71 | 80 |
72 } // namespace disk_cache | 81 } // namespace disk_cache |
73 | 82 |
74 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_UTIL_H_ | 83 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_UTIL_H_ |
OLD | NEW |