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

Unified Diff: net/base/host_resolver_impl.cc

Issue 214025: Make sure that the LoadLog does not get freed on the worker thread during req... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 3 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/host_resolver_impl.cc
===================================================================
--- net/base/host_resolver_impl.cc (revision 26431)
+++ net/base/host_resolver_impl.cc (working copy)
@@ -73,6 +73,9 @@
job_ = NULL;
callback_ = NULL;
addresses_ = NULL;
+ // Clear the LoadLog to make sure it won't be released later on the
wtc 2009/09/21 18:14:12 Do you mean clearing the load log (i.e., emptying
+ // worker thread. See http://crbug.com/22272
+ load_log_ = NULL;
}
bool was_cancelled() const {
@@ -187,10 +190,8 @@
origin_loop_ = NULL;
}
- // We don't have to do anything further to actually cancel the requests
- // that were attached to this job (since they are unreachable now).
- // But we will call HostResolverImpl::CancelRequest(Request*) on each one
- // in order to notify any observers.
+ // We will call HostResolverImpl::CancelRequest(Request*) on each one
+ // in order to notify any observers, and also clear the LoadLog.
for (RequestsList::const_iterator it = requests_.begin();
it != requests_.end(); ++it) {
HostResolverImpl::Request* req = *it;
@@ -395,9 +396,11 @@
Request* req = reinterpret_cast<Request*>(req_handle);
DCHECK(req);
DCHECK(req->job());
+ // Hold a reference to the request's load log as we are about to clear it.
wtc 2009/09/21 18:14:12 Nit: it's not clear what "it" refers to here. Do
+ scoped_refptr<LoadLog> load_log(req->load_log());
// NULL out the fields of req, to mark it as cancelled.
req->MarkAsCancelled();
- OnCancelRequest(req->load_log(), req->id(), req->info());
+ OnCancelRequest(load_log, req->id(), req->info());
}
void HostResolverImpl::AddObserver(Observer* observer) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698