| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 GetFilenameFromEntryHashAndFileIndex(uint64 entry_hash, | 48 std::string GetFilenameFromEntryHashAndFileIndex(uint64 entry_hash, |
| 49 int file_index); | 49 int file_index); |
| 50 | 50 |
| 51 // Given a |key| for an entry, returns the name of the sparse data file. | 51 // Given a |key| for an entry, returns the name of the sparse data file. |
| 52 std::string GetSparseFilenameFromEntryHash(uint64 entry_hash); | 52 std::string GetSparseFilenameFromEntryHash(uint64 entry_hash); |
| 53 | 53 |
| 54 // Given the size of a file holding a stream in the simple backend and the key | 54 // Given the size of a file holding a stream in the simple backend and the key |
| 55 // to an entry, returns the number of bytes in the stream. | 55 // to an entry, returns the number of bytes in the stream. |
| 56 NET_EXPORT_PRIVATE int32 GetDataSizeFromKeyAndFileSize(const std::string& key, | 56 NET_EXPORT_PRIVATE int32 |
| 57 int64 file_size); | 57 GetDataSizeFromKeyAndFileSize(const std::string& key, int64 file_size); |
| 58 | 58 |
| 59 // Given the size of a stream in the simple backend and the key to an entry, | 59 // Given the size of a stream in the simple backend and the key to an entry, |
| 60 // returns the number of bytes in the file. | 60 // returns the number of bytes in the file. |
| 61 NET_EXPORT_PRIVATE int64 GetFileSizeFromKeyAndDataSize(const std::string& key, | 61 NET_EXPORT_PRIVATE int64 |
| 62 int32 data_size); | 62 GetFileSizeFromKeyAndDataSize(const std::string& key, int32 data_size); |
| 63 | 63 |
| 64 // Given the stream index, returns the number of the file the stream is stored | 64 // Given the stream index, returns the number of the file the stream is stored |
| 65 // in. | 65 // in. |
| 66 NET_EXPORT_PRIVATE int GetFileIndexFromStreamIndex(int stream_index); | 66 NET_EXPORT_PRIVATE int GetFileIndexFromStreamIndex(int stream_index); |
| 67 | 67 |
| 68 // Fills |out_time| with the time the file last modified time. Unlike the | 68 // Fills |out_time| with the time the file last modified time. Unlike the |
| 69 // functions in file.h, the time resolution is milliseconds. | 69 // functions in file.h, the time resolution is milliseconds. |
| 70 NET_EXPORT_PRIVATE bool GetMTime(const base::FilePath& path, | 70 NET_EXPORT_PRIVATE bool GetMTime(const base::FilePath& path, |
| 71 base::Time* out_mtime); | 71 base::Time* out_mtime); |
| 72 } // namespace simple_backend | 72 } // namespace simple_backend |
| 73 | 73 |
| 74 } // namespace disk_cache | 74 } // namespace disk_cache |
| 75 | 75 |
| 76 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_UTIL_H_ | 76 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_UTIL_H_ |
| OLD | NEW |