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

Side by Side Diff: net/disk_cache/simple/simple_util.cc

Issue 22927018: Avoid fragmenting the heap too much while reconstructing the index. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix windows build (part 2) Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/disk_cache/simple/simple_util.h ('k') | net/net.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « net/disk_cache/simple/simple_util.h ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698