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 22 matching lines...) Expand all Loading... | |
33 | 33 |
34 // Parses the |hash_key| string into a uint64 buffer. | 34 // Parses the |hash_key| string into a uint64 buffer. |
35 // |hash_key| string must be of the form: FFFFFFFFFFFFFFFF . | 35 // |hash_key| string must be of the form: FFFFFFFFFFFFFFFF . |
36 NET_EXPORT_PRIVATE bool GetEntryHashKeyFromHexString( | 36 NET_EXPORT_PRIVATE bool GetEntryHashKeyFromHexString( |
37 const base::StringPiece& hash_key, | 37 const base::StringPiece& hash_key, |
38 uint64* hash_key_out); | 38 uint64* hash_key_out); |
39 | 39 |
40 // Given a |key| for a (potential) entry in the simple backend and the |index| | 40 // Given a |key| for a (potential) entry in the simple backend and the |index| |
41 // of a stream on that entry, returns the filename in which that stream would be | 41 // of a stream on that entry, returns the filename in which that stream would be |
42 // stored. | 42 // stored. |
43 NET_EXPORT_PRIVATE std::string GetFilenameFromKeyAndIndex( | 43 NET_EXPORT_PRIVATE std::string GetFilenameFromKeyAndFileIndex( |
44 const std::string& key, | 44 const std::string& key, |
45 int index); | 45 int file_index); |
46 | 46 |
47 // Same as |GetFilenameFromKeyAndIndex| above, but using a hex string. | 47 // Same as |GetFilenameFromKeyAndIndex| above, but using a hex string. |
48 std::string GetFilenameFromEntryHashAndIndex(uint64 entry_hash, int index); | 48 std::string GetFilenameFromEntryHashAndFileIndex(uint64 entry_hash, |
49 int file_index); | |
49 | 50 |
50 // Given the size of a file holding a stream in the simple backend and the key | 51 // 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. | 52 // to an entry, returns the number of bytes in the stream. |
52 NET_EXPORT_PRIVATE int32 GetDataSizeFromKeyAndFileSize(const std::string& key, | 53 NET_EXPORT_PRIVATE int32 GetDataSizeFromKeyAndFileSize(const std::string& key, |
53 int64 file_size); | 54 int64 file_size); |
54 | 55 |
55 // Given the size of a stream in the simple backend and the key to an entry, | 56 // 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. | 57 // returns the number of bytes in the file. |
57 NET_EXPORT_PRIVATE int64 GetFileSizeFromKeyAndDataSize(const std::string& key, | 58 NET_EXPORT_PRIVATE int64 GetFileSizeFromKeyAndDataSize(const std::string& key, |
58 int32 data_size); | 59 int32 data_size); |
59 | 60 // Given the stream index, returns the number of the file the stream is stored |
pasko
2013/09/17 16:40:52
nit: please add an empty line above
clamy
2013/09/18 16:17:15
Done.
| |
60 // Given the key to an entry, and an offset into a stream on that entry, returns | 61 // in. |
61 // the file offset corresponding to |data_offset|. | 62 NET_EXPORT_PRIVATE int GetFileIndexFromStreamIndex(int stream_index); |
62 NET_EXPORT_PRIVATE int64 GetFileOffsetFromKeyAndDataOffset( | |
63 const std::string& key, | |
64 int data_offset); | |
65 | 63 |
66 // Fills |out_time| with the time the file last modified time. Unlike the | 64 // Fills |out_time| with the time the file last modified time. Unlike the |
67 // functions in platform_file.h, the time resolution is milliseconds. | 65 // functions in platform_file.h, the time resolution is milliseconds. |
68 NET_EXPORT_PRIVATE bool GetMTime(const base::FilePath& path, | 66 NET_EXPORT_PRIVATE bool GetMTime(const base::FilePath& path, |
69 base::Time* out_mtime); | 67 base::Time* out_mtime); |
70 } // namespace simple_backend | 68 } // namespace simple_backend |
71 | 69 |
72 } // namespace disk_cache | 70 } // namespace disk_cache |
73 | 71 |
74 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_UTIL_H_ | 72 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_UTIL_H_ |
OLD | NEW |