| 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" |
| 11 #include "base/strings/string_piece.h" |
| 11 #include "net/base/net_export.h" | 12 #include "net/base/net_export.h" |
| 12 | 13 |
| 13 namespace base { | 14 namespace base { |
| 14 class FilePath; | 15 class FilePath; |
| 15 class Time; | 16 class Time; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace disk_cache { | 19 namespace disk_cache { |
| 19 | 20 |
| 20 namespace simple_util { | 21 namespace simple_util { |
| 21 | 22 |
| 22 NET_EXPORT_PRIVATE std::string ConvertEntryHashKeyToHexString(uint64 hash_key); | 23 NET_EXPORT_PRIVATE std::string ConvertEntryHashKeyToHexString(uint64 hash_key); |
| 23 | 24 |
| 24 // |key| is the regular cache key, such as an URL. | 25 // |key| is the regular cache key, such as an URL. |
| 25 // Returns the Hex ascii representation of the uint64 hash_key. | 26 // Returns the Hex ascii representation of the uint64 hash_key. |
| 26 NET_EXPORT_PRIVATE std::string GetEntryHashKeyAsHexString( | 27 NET_EXPORT_PRIVATE std::string GetEntryHashKeyAsHexString( |
| 27 const std::string& key); | 28 const std::string& key); |
| 28 | 29 |
| 29 // |key| is the regular HTTP Cache key, which is a URL. | 30 // |key| is the regular HTTP Cache key, which is a URL. |
| 30 // Returns the hash of the key as uint64. | 31 // Returns the hash of the key as uint64. |
| 31 NET_EXPORT_PRIVATE uint64 GetEntryHashKey(const std::string& key); | 32 NET_EXPORT_PRIVATE uint64 GetEntryHashKey(const std::string& key); |
| 32 | 33 |
| 33 // Parses the |hash_key| string into a uint64 buffer. | 34 // Parses the |hash_key| string into a uint64 buffer. |
| 34 // |hash_key| string must be of the form: FFFFFFFFFFFFFFFF . | 35 // |hash_key| string must be of the form: FFFFFFFFFFFFFFFF . |
| 35 NET_EXPORT_PRIVATE bool GetEntryHashKeyFromHexString( | 36 NET_EXPORT_PRIVATE bool GetEntryHashKeyFromHexString( |
| 36 const std::string& hash_key, | 37 const base::StringPiece& hash_key, |
| 37 uint64* hash_key_out); | 38 uint64* hash_key_out); |
| 38 | 39 |
| 39 // 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| |
| 40 // 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 |
| 41 // stored. | 42 // stored. |
| 42 NET_EXPORT_PRIVATE std::string GetFilenameFromKeyAndIndex( | 43 NET_EXPORT_PRIVATE std::string GetFilenameFromKeyAndIndex( |
| 43 const std::string& key, | 44 const std::string& key, |
| 44 int index); | 45 int index); |
| 45 | 46 |
| 46 // Same as |GetFilenameFromKeyAndIndex| above, but using a hex string. | 47 // Same as |GetFilenameFromKeyAndIndex| above, but using a hex string. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 64 | 65 |
| 65 // Fills |out_time| with the time the file last modified time. | 66 // Fills |out_time| with the time the file last modified time. |
| 66 // TODO(gavinp): Remove this function. | 67 // TODO(gavinp): Remove this function. |
| 67 NET_EXPORT_PRIVATE bool GetMTime(const base::FilePath& path, | 68 NET_EXPORT_PRIVATE bool GetMTime(const base::FilePath& path, |
| 68 base::Time* out_mtime); | 69 base::Time* out_mtime); |
| 69 } // namespace simple_backend | 70 } // namespace simple_backend |
| 70 | 71 |
| 71 } // namespace disk_cache | 72 } // namespace disk_cache |
| 72 | 73 |
| 73 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_UTIL_H_ | 74 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_UTIL_H_ |
| OLD | NEW |