summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/backend_impl.cc
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2011-11-17 03:22:21 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2011-11-17 03:22:21 -0800
commit6c56142cac0a61d46d4a444ffe09cfbf1a66c876 (patch)
treed0cb945cc7a86deeb1c48449e0cbc6fc7bec1d6b /net/disk_cache/backend_impl.cc
parent3a14c9bbe51d89a2d6435c3cec12f59675bde0a8 (diff)
parent1ab02c36bee95e85558f6815b2836e9ee6a26b19 (diff)
downloadexternal_chromium-6c56142cac0a61d46d4a444ffe09cfbf1a66c876.zip
external_chromium-6c56142cac0a61d46d4a444ffe09cfbf1a66c876.tar.gz
external_chromium-6c56142cac0a61d46d4a444ffe09cfbf1a66c876.tar.bz2
am 1ab02c36: Part of fix for bug 5523834, backporting cache fixes
* commit '1ab02c36bee95e85558f6815b2836e9ee6a26b19': Part of fix for bug 5523834, backporting cache fixes
Diffstat (limited to 'net/disk_cache/backend_impl.cc')
-rw-r--r--net/disk_cache/backend_impl.cc9
1 files changed, 1 insertions, 8 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index c5b7724..e5d889f 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -723,14 +723,7 @@ EntryImpl* BackendImpl::CreateEntryImpl(const std::string& key) {
}
}
- int num_blocks;
- size_t key1_len = sizeof(EntryStore) - offsetof(EntryStore, key);
- if (key.size() < key1_len ||
- key.size() > static_cast<size_t>(kMaxInternalKeyLength))
- num_blocks = 1;
- else
- num_blocks = static_cast<int>((key.size() - key1_len) / 256 + 2);
-
+ int num_blocks = EntryImpl::NumBlocksForEntry(key.size());
if (!block_files_.CreateBlock(BLOCK_256, num_blocks, &entry_address)) {
LOG(ERROR) << "Create entry failed " << key.c_str();
stats_.OnEvent(Stats::CREATE_ERROR);