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

Unified Diff: net/http/http_cache.cc

Issue 3016006: Http Cache: Don't delete the callback that is waiting for... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 5 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 | « no previous file | net/http/http_cache_unittest.cc » ('j') | net/http/http_cache_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_cache.cc
===================================================================
--- net/http/http_cache.cc (revision 52557)
+++ net/http/http_cache.cc (working copy)
@@ -134,10 +134,15 @@
~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 @@
// 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;
« no previous file with comments | « no previous file | net/http/http_cache_unittest.cc » ('j') | net/http/http_cache_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698