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

Unified Diff: net/http/http_cache.cc

Issue 21369: Use RevocableStore to isolate the http cache from its transactions.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 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 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 ||
« 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