diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-26 16:51:10 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-26 16:51:10 +0000 |
commit | d5b94c7b5748d2d97aeb01b6d3a6e7493f87f3aa (patch) | |
tree | 3c31e288218fb30898a151d3f8761a124ae5fc92 /net/http/http_cache.cc | |
parent | 11651ca8e83aeead41d145aa7a5a943dd0392919 (diff) | |
download | chromium_src-d5b94c7b5748d2d97aeb01b6d3a6e7493f87f3aa.zip chromium_src-d5b94c7b5748d2d97aeb01b6d3a6e7493f87f3aa.tar.gz chromium_src-d5b94c7b5748d2d97aeb01b6d3a6e7493f87f3aa.tar.bz2 |
Http cache: Make sure that we remove pending transactions
when they belong to a doomed entry.
BUG=25588
TEST=unittests
Review URL: http://codereview.chromium.org/335015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30054 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_cache.cc')
-rw-r--r-- | net/http/http_cache.cc | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc index eee9397..f9cdd5e 100644 --- a/net/http/http_cache.cc +++ b/net/http/http_cache.cc @@ -979,6 +979,9 @@ int HttpCache::Transaction::ValidateEntryHeadersAndContinue( bool byte_range_requested) { DCHECK(mode_ == READ_WRITE); + if (!cache_) + return HandleResult(ERR_UNEXPECTED); + if (!partial_->UpdateFromStoredHeaders(response_.headers, entry_->disk_entry, truncated_)) { // The stored data cannot be used. Get rid of it and restart this request. @@ -2044,17 +2047,29 @@ void HttpCache::ConvertWriterToReader(ActiveEntry* entry) { void HttpCache::RemovePendingTransaction(Transaction* trans) { ActiveEntriesMap::const_iterator i = active_entries_.find(trans->key()); - if (i == active_entries_.end()) + bool found = false; + if (i != active_entries_.end()) + found = RemovePendingTransactionFromEntry(i->second, trans); + + if (found) return; - TransactionList& pending_queue = i->second->pending_queue; + ActiveEntriesSet::iterator it = doomed_entries_.begin(); + for (; it != doomed_entries_.end() && !found; ++it) + found = RemovePendingTransactionFromEntry(*it, trans); +} + +bool HttpCache::RemovePendingTransactionFromEntry(ActiveEntry* entry, + Transaction* trans) { + TransactionList& pending_queue = entry->pending_queue; TransactionList::iterator j = find(pending_queue.begin(), pending_queue.end(), trans); if (j == pending_queue.end()) - return; + return false; pending_queue.erase(j); + return true; } void HttpCache::ProcessPendingQueue(ActiveEntry* entry) { |