Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Unified Diff: net/disk_cache/simple/simple_util.cc

Issue 14295012: Revert 194347 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/disk_cache/simple/simple_util.h ('k') | net/disk_cache/simple/simple_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/simple/simple_util.cc
===================================================================
--- net/disk_cache/simple/simple_util.cc (revision 194371)
+++ net/disk_cache/simple/simple_util.cc (working copy)
@@ -6,54 +6,17 @@
#include <limits>
-#include "base/format_macros.h"
#include "base/logging.h"
-#include "base/sha1.h"
#include "base/stringprintf.h"
-#include "base/strings/string_number_conversions.h"
-#include "net/disk_cache/simple/simple_entry_format.h"
+#include "net/disk_cache/simple/simple_disk_format.h"
-namespace {
-
-// Size of the uint64 hash_key number in Hex format in a string.
-const size_t kEntryHashKeyAsHexStringSize = 2 * sizeof(uint64);
-
-} // namespace
-
namespace disk_cache {
namespace simple_util {
-std::string ConvertEntryHashKeyToHexString(uint64 hash_key) {
- const std::string hash_key_str = base::StringPrintf("%016" PRIx64, hash_key);
- DCHECK_EQ(kEntryHashKeyAsHexStringSize, hash_key_str.size());
- return hash_key_str;
-}
-
-std::string GetEntryHashKeyAsHexString(const std::string& key) {
- std::string hash_key_str =
- ConvertEntryHashKeyToHexString(GetEntryHashKey(key));
- DCHECK_EQ(kEntryHashKeyAsHexStringSize, hash_key_str.size());
- return hash_key_str;
-}
-
-bool GetEntryHashKeyFromHexString(const std::string& hash_key,
- uint64* hash_key_out) {
- if (hash_key.size() != kEntryHashKeyAsHexStringSize) {
- return false;
- }
- return base::HexStringToUInt64(hash_key, hash_key_out);
-}
-
-uint64 GetEntryHashKey(const std::string& key) {
- const std::string sha_hash = base::SHA1HashString(key);
- uint64 hash_key = 0;
- sha_hash.copy(reinterpret_cast<char*>(&hash_key), sizeof(hash_key));
- return hash_key;
-}
-
std::string GetFilenameFromKeyAndIndex(const std::string& key, int index) {
- return GetEntryHashKeyAsHexString(key) + base::StringPrintf("_%1d", index);
+ return disk_cache::GetEntryHashKeyAsHexString(key) +
+ base::StringPrintf("_%1d", index);
}
int32 GetDataSizeFromKeyAndFileSize(const std::string& key, int64 file_size) {
« no previous file with comments | « net/disk_cache/simple/simple_util.h ('k') | net/disk_cache/simple/simple_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698