summaryrefslogtreecommitdiffstats
path: root/net/http/http_cache.cc
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-17 00:29:25 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-17 00:29:25 +0000
commite86e79d31b18a6a32e4bd2bf470c72a20b9815ca (patch)
treecb5a74589af9a1424bd867f5ab4f93b2c8b2c2b3 /net/http/http_cache.cc
parent731321382230f99f91a9e46917eb64691583f65b (diff)
downloadchromium_src-e86e79d31b18a6a32e4bd2bf470c72a20b9815ca.zip
chromium_src-e86e79d31b18a6a32e4bd2bf470c72a20b9815ca.tar.gz
chromium_src-e86e79d31b18a6a32e4bd2bf470c72a20b9815ca.tar.bz2
Http Cache: Don't delete the callback that is waiting for
the backend creation when the cache goes away. BUG=49193 TEST=net_unittests Review URL: http://codereview.chromium.org/3016006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52776 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_cache.cc')
-rw-r--r--net/http/http_cache.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc
index fb89928..552d9c4 100644
--- a/net/http/http_cache.cc
+++ b/net/http/http_cache.cc
@@ -134,10 +134,15 @@ class HttpCache::BackendCallback : public CallbackRunner<Tuple1<int> > {
~BackendCallback() {}
virtual void RunWithParams(const Tuple1<int>& params) {
- cache_->OnIOComplete(params.a, pending_op_);
+ if (cache_)
+ cache_->OnIOComplete(params.a, pending_op_);
delete this;
}
+ void Cancel() {
+ cache_ = NULL;
+ }
+
private:
HttpCache* cache_;
PendingOp* pending_op_;
@@ -283,7 +288,15 @@ HttpCache::~HttpCache() {
// though they are waiting for a callback that will never fire.
PendingOp* pending_op = pending_it->second;
delete pending_op->writer;
- delete pending_op->callback;
+ if (building_backend_) {
+ // If we don't have a backend, when its construction finishes it will
+ // deliver the callbacks.
+ BackendCallback* callback =
+ static_cast<BackendCallback*>(pending_op->callback);
+ callback->Cancel();
+ } else {
+ delete pending_op->callback;
+ }
STLDeleteElements(&pending_op->pending_queue);
delete pending_op;