From 65188eb51c19157f9b360c84acbfa66543f0d781 Mon Sep 17 00:00:00 2001 From: "rvargas@google.com" Date: Thu, 16 Sep 2010 20:59:29 +0000 Subject: Disk cache: Fix the order in which we delete data from the block files. Stress testing the cache reveals a problem with the deletion of some data from an entry: it is possible to crash in a way that the block file thinks a block is free and an entry thinks the block is in use. This CL corrects that issue. There is also some new tests and a bunch of DCHECKS added while looking for the problem, as well as adding tests to make sure that a block file is accessed only from one thread (there is no problem with the current code in that regard) BUG=55605 TEST=netunittests Review URL: http://codereview.chromium.org/3430004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59711 0039d316-1c4b-4281-b951-d872f2087c98 --- net/disk_cache/disk_cache_test_base.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'net/disk_cache/disk_cache_test_base.cc') diff --git a/net/disk_cache/disk_cache_test_base.cc b/net/disk_cache/disk_cache_test_base.cc index 3edfffd..cffe3fa 100644 --- a/net/disk_cache/disk_cache_test_base.cc +++ b/net/disk_cache/disk_cache_test_base.cc @@ -193,6 +193,18 @@ void DiskCacheTestWithCache::FlushQueueForTest() { EXPECT_EQ(net::OK, cb.GetResult(rv)); } +void DiskCacheTestWithCache::RunTaskForTest(Task* task) { + if (memory_only_ || !cache_impl_) { + task->Run(); + delete task; + return; + } + + TestCompletionCallback cb; + int rv = cache_impl_->RunTaskForTest(task, &cb); + EXPECT_EQ(net::OK, cb.GetResult(rv)); +} + int DiskCacheTestWithCache::ReadData(disk_cache::Entry* entry, int index, int offset, net::IOBuffer* buf, int len) { TestCompletionCallback cb; -- cgit v1.1