diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-29 18:59:03 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-29 18:59:03 +0000 |
commit | e47737e2a8eb0e3f321c0c4ff39255c8f60f82d2 (patch) | |
tree | 9737555e08e63549bf628c3ba4883a6555cfab22 /net/disk_cache/block_files.cc | |
parent | 1b570ee3cd4e89c2ff0d38098e04d3db20bc5ada (diff) | |
download | chromium_src-e47737e2a8eb0e3f321c0c4ff39255c8f60f82d2.zip chromium_src-e47737e2a8eb0e3f321c0c4ff39255c8f60f82d2.tar.gz chromium_src-e47737e2a8eb0e3f321c0c4ff39255c8f60f82d2.tar.bz2 |
Disk Cache: Improve handling of dirty entries.
* Split the entry sanity checks in two parts: a critical one
and a non-critical one. This allows us to return dirty entries
instead of failing to open them.
* Make sure that we cannot reach an entry through the index
before the actual data reaches the disk (when creating an entry
linked through a parent we were not respecting that).
* When deleting a block from a block file, first clean it
up and then update the map (avoid leaving a dirty free block
if there is a crash)
* Handle the case of errors when opening entries through the
enumerations path.
BUG=73102
TEST=net_unittests
Review URL: http://codereview.chromium.org/8065015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103323 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/block_files.cc')
-rw-r--r-- | net/disk_cache/block_files.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/disk_cache/block_files.cc b/net/disk_cache/block_files.cc index d73953d..3c87d92 100644 --- a/net/disk_cache/block_files.cc +++ b/net/disk_cache/block_files.cc @@ -287,15 +287,15 @@ void BlockFiles::DeleteBlock(Addr address, bool deep) { Trace("DeleteBlock 0x%x", address.value()); - BlockFileHeader* header = reinterpret_cast<BlockFileHeader*>(file->buffer()); - DeleteMapBlock(address.start_block(), address.num_blocks(), header); - size_t size = address.BlockSize() * address.num_blocks(); size_t offset = address.start_block() * address.BlockSize() + kBlockHeaderSize; if (deep) file->Write(zero_buffer_, size, offset); + BlockFileHeader* header = reinterpret_cast<BlockFileHeader*>(file->buffer()); + DeleteMapBlock(address.start_block(), address.num_blocks(), header); + if (!header->num_entries) { // This file is now empty. Let's try to delete it. FileType type = Addr::RequiredFileType(header->entry_size); |