Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Unified Diff: net/http/http_cache.cc

Issue 335015: Http cache: Make sure that we remove pending transactions... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_cache.h ('k') | net/http/http_cache_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_cache.cc
===================================================================
--- net/http/http_cache.cc (revision 29792)
+++ net/http/http_cache.cc (working copy)
@@ -979,6 +979,9 @@
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::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) {
« no previous file with comments | « net/http/http_cache.h ('k') | net/http/http_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698