Index: net/disk_cache/entry_impl.cc |
=================================================================== |
--- net/disk_cache/entry_impl.cc (revision 199883) |
+++ net/disk_cache/entry_impl.cc (working copy) |
@@ -13,6 +13,7 @@ |
#include "net/disk_cache/backend_impl.h" |
#include "net/disk_cache/bitmap.h" |
#include "net/disk_cache/cache_util.h" |
+#include "net/disk_cache/disk_format.h" |
#include "net/disk_cache/histogram_macros.h" |
#include "net/disk_cache/net_log_parameters.h" |
#include "net/disk_cache/sparse_control.h" |
@@ -581,7 +582,7 @@ |
return false; |
Addr next_addr(stored->next); |
- if (next_addr.is_initialized() && !next_addr.SanityCheckForEntry()) { |
+ if (next_addr.is_initialized() && !next_addr.SanityCheckForEntryV2()) { |
STRESS_NOTREACHED(); |
return false; |
} |
@@ -595,7 +596,7 @@ |
(stored->key_len > kMaxInternalKeyLength && !key_addr.is_initialized())) |
return false; |
- if (!key_addr.SanityCheck()) |
+ if (!key_addr.SanityCheckV2()) |
return false; |
if (key_addr.is_initialized() && |
@@ -628,7 +629,7 @@ |
return false; |
if (!data_size && data_addr.is_initialized()) |
return false; |
- if (!data_addr.SanityCheck()) |
+ if (!data_addr.SanityCheckV2()) |
return false; |
if (!data_size) |
continue; |
@@ -653,7 +654,7 @@ |
if (data_addr.is_initialized()) { |
if ((data_size <= kMaxBlockSize && data_addr.is_separate_file()) || |
(data_size > kMaxBlockSize && data_addr.is_block_file()) || |
- !data_addr.SanityCheck()) { |
+ !data_addr.SanityCheckV2()) { |
STRESS_NOTREACHED(); |
// The address is weird so don't attempt to delete it. |
stored->data_addr[i] = 0; |
@@ -1181,8 +1182,7 @@ |
if (!backend_->CreateExternalFile(address)) |
return false; |
} else { |
- int num_blocks = (size + Addr::BlockSizeForFileType(file_type) - 1) / |
- Addr::BlockSizeForFileType(file_type); |
+ int num_blocks = Addr::RequiredBlocks(size, file_type); |
if (!backend_->CreateBlock(file_type, num_blocks, address)) |
return false; |
@@ -1289,7 +1289,7 @@ |
} |
if (!user_buffers_[index].get()) |
- user_buffers_[index].reset(new UserBuffer(backend_)); |
+ user_buffers_[index].reset(new UserBuffer(backend_.get())); |
return PrepareBuffer(index, offset, buf_len); |
} |
@@ -1360,7 +1360,7 @@ |
DCHECK(address.is_initialized()); |
int len = std::min(entry_.Data()->data_size[index], kMaxBlockSize); |
- user_buffers_[index].reset(new UserBuffer(backend_)); |
+ user_buffers_[index].reset(new UserBuffer(backend_.get())); |
user_buffers_[index]->Write(len, NULL, 0); |
File* file = GetBackingFile(address, index); |