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

Unified Diff: net/disk_cache/entry_impl.cc

Issue 15203004: Disk cache: Reference CL for the implementation of file format version 3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: IndexTable review Created 7 years, 1 month 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/entry_impl.h ('k') | net/disk_cache/entry_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « net/disk_cache/entry_impl.h ('k') | net/disk_cache/entry_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698