Skip to content

Commit

Permalink
Disk cache: Modify when we report empty cache files.
Browse files Browse the repository at this point in the history
BUG=none
TEST=none
TBR=gavinp
Review URL: https://chromiumcodereview.appspot.com/10317023

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135503 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
rvargas@google.com committed May 5, 2012
1 parent 3553da7 commit ced98e8
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions net/disk_cache/backend_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ int BackendImpl::SyncInit() {
return net::ERR_FAILED;
}

if (create_files || !data_->header.num_entries)
if (!restarted_ && (create_files || !data_->header.num_entries))
ReportError(ERR_CACHE_CREATED);

if (!(user_flags_ & kNoRandom) &&
Expand All @@ -465,12 +465,8 @@ int BackendImpl::SyncInit() {
if (!data_->header.this_id)
data_->header.this_id++;

if (data_->header.crash) {
ReportError(ERR_PREVIOUS_CRASH);
} else {
ReportError(ERR_NO_ERROR);
data_->header.crash = 1;
}
bool previous_crash = (data_->header.crash != 0);
data_->header.crash = 1;

if (!block_files_.Init(create_files))
return net::ERR_FAILED;
Expand Down Expand Up @@ -501,6 +497,12 @@ int BackendImpl::SyncInit() {
trace_object_->EnableTracing(true);
#endif

if (previous_crash) {
ReportError(ERR_PREVIOUS_CRASH);
} else if (!restarted_) {
ReportError(ERR_NO_ERROR);
}

return disabled_ ? net::ERR_FAILED : net::OK;
}

Expand Down

0 comments on commit ced98e8

Please sign in to comment.