summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/backend_impl.cc
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-28 01:32:25 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-28 01:32:25 +0000
commitdc8b936deddb16343b09df857bbdd75f11f9408d (patch)
tree813e0f7a7d4cd466133e9742c84944f7655078e1 /net/disk_cache/backend_impl.cc
parent266bc72a27ab755abfcad858d702c891ee2c9155 (diff)
downloadchromium_src-dc8b936deddb16343b09df857bbdd75f11f9408d.zip
chromium_src-dc8b936deddb16343b09df857bbdd75f11f9408d.tar.gz
chromium_src-dc8b936deddb16343b09df857bbdd75f11f9408d.tar.bz2
Disk cache: Reset mask_ when the disk cache is being restarted.
It is possible that the size for the index table is reduced when the cache is restarted (the available disk space could be lower than what it was when the cache was originally created). If that is the case, not resetting mask_ to 0 will prevent the mask to be set correctly for the new table size, resulting in a crash. BUG=12378 TEST=unittests Review URL: http://codereview.chromium.org/113930 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17052 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/backend_impl.cc')
-rw-r--r--net/disk_cache/backend_impl.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index e997b90..5c64d01 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -788,6 +788,10 @@ void BackendImpl::CriticalError(int error) {
LogStats();
ReportError(error);
+ // Reset the mask_ if it was not given by the user.
+ if (mask_ == data_->header.table_len - 1)
+ mask_ = 0;
+
// Setting the index table length to an invalid value will force re-creation
// of the cache files.
data_->header.table_len = 1;
@@ -983,6 +987,10 @@ void BackendImpl::RestartCache() {
}
void BackendImpl::PrepareForRestart() {
+ // Reset the mask_ if it was not given by the user.
+ if (mask_ == data_->header.table_len - 1)
+ mask_ = 0;
+
data_->header.crash = 0;
index_ = NULL;
data_ = NULL;