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 #include "net/disk_cache/simple/simple_util.h" | 5 #include "net/disk_cache/simple/simple_util.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 return hash_key_str; | 33 return hash_key_str; |
34 } | 34 } |
35 | 35 |
36 std::string GetEntryHashKeyAsHexString(const std::string& key) { | 36 std::string GetEntryHashKeyAsHexString(const std::string& key) { |
37 std::string hash_key_str = | 37 std::string hash_key_str = |
38 ConvertEntryHashKeyToHexString(GetEntryHashKey(key)); | 38 ConvertEntryHashKeyToHexString(GetEntryHashKey(key)); |
39 DCHECK_EQ(kEntryHashKeyAsHexStringSize, hash_key_str.size()); | 39 DCHECK_EQ(kEntryHashKeyAsHexStringSize, hash_key_str.size()); |
40 return hash_key_str; | 40 return hash_key_str; |
41 } | 41 } |
42 | 42 |
43 bool GetEntryHashKeyFromHexString(const std::string& hash_key, | 43 bool GetEntryHashKeyFromHexString(const base::StringPiece& hash_key, |
44 uint64* hash_key_out) { | 44 uint64* hash_key_out) { |
45 if (hash_key.size() != kEntryHashKeyAsHexStringSize) { | 45 if (hash_key.size() != kEntryHashKeyAsHexStringSize) { |
46 return false; | 46 return false; |
47 } | 47 } |
48 return base::HexStringToUInt64(hash_key, hash_key_out); | 48 return base::HexStringToUInt64(hash_key, hash_key_out); |
49 } | 49 } |
50 | 50 |
51 uint64 GetEntryHashKey(const std::string& key) { | 51 uint64 GetEntryHashKey(const std::string& key) { |
52 union { | 52 union { |
53 unsigned char sha_hash[base::kSHA1Length]; | 53 unsigned char sha_hash[base::kSHA1Length]; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 base::PlatformFileInfo file_info; | 91 base::PlatformFileInfo file_info; |
92 if (!file_util::GetFileInfo(path, &file_info)) | 92 if (!file_util::GetFileInfo(path, &file_info)) |
93 return false; | 93 return false; |
94 *out_mtime = file_info.last_modified; | 94 *out_mtime = file_info.last_modified; |
95 return true; | 95 return true; |
96 } | 96 } |
97 | 97 |
98 } // namespace simple_backend | 98 } // namespace simple_backend |
99 | 99 |
100 } // namespace disk_cache | 100 } // namespace disk_cache |
OLD | NEW |