Index: net/http/http_cache.cc |
=================================================================== |
--- net/http/http_cache.cc (revision 9641) |
+++ net/http/http_cache.cc (working copy) |
@@ -160,10 +160,12 @@ |
//----------------------------------------------------------------------------- |
-class HttpCache::Transaction : public HttpTransaction { |
+class HttpCache::Transaction |
+ : public HttpTransaction, public RevocableStore::Revocable { |
public: |
explicit Transaction(HttpCache* cache) |
- : request_(NULL), |
+ : RevocableStore::Revocable(&cache->transactions_), |
+ request_(NULL), |
cache_(cache), |
entry_(NULL), |
network_trans_(NULL), |
@@ -318,10 +320,12 @@ |
}; |
HttpCache::Transaction::~Transaction() { |
- if (entry_) { |
- cache_->DoneWithEntry(entry_, this); |
- } else { |
- cache_->RemovePendingTransaction(this); |
+ if (!revoked()) { |
+ if (entry_) { |
+ cache_->DoneWithEntry(entry_, this); |
+ } else { |
+ cache_->RemovePendingTransaction(this); |
+ } |
} |
// If there is an outstanding callback, mark it as cancelled so running it |
@@ -341,6 +345,9 @@ |
// ensure that we only have one asynchronous call at a time. |
DCHECK(!callback_); |
+ if (revoked()) |
+ return ERR_FAILED; |
+ |
SetRequest(request); |
int rv; |
@@ -485,6 +492,9 @@ |
int HttpCache::Transaction::AddToEntry() { |
ActiveEntry* entry = NULL; |
+ if (revoked()) |
+ return ERR_FAILED; |
+ |
if (mode_ == WRITE) { |
cache_->DoomEntry(cache_key_); |
} else { |
@@ -842,6 +852,9 @@ |
void HttpCache::Transaction::OnNetworkInfoAvailable(int result) { |
DCHECK(result != ERR_IO_PENDING); |
+ if (revoked()) |
+ return; |
+ |
if (result == OK) { |
const HttpResponseInfo* new_response = network_trans_->GetResponseInfo(); |
if (new_response->headers->response_code() == 401 || |