summaryrefslogtreecommitdiffstats
path: root/net/base/host_resolver_impl.cc
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-29 22:21:00 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-29 22:21:00 +0000
commit27f99c872ffb123323e03bfcaa8bd89a1b0579d8 (patch)
tree12985ccdc3454e5adc9935cb62d8b4192fc1e6d8 /net/base/host_resolver_impl.cc
parent617176577ba1075f139b7627950876b017510d18 (diff)
downloadchromium_src-27f99c872ffb123323e03bfcaa8bd89a1b0579d8.zip
chromium_src-27f99c872ffb123323e03bfcaa8bd89a1b0579d8.tar.gz
chromium_src-27f99c872ffb123323e03bfcaa8bd89a1b0579d8.tar.bz2
Make LoadLog refcounted-thread safe.
This also backs out r26610 (these are the changes to host_resolver_impl.cc), since that code is no longer necessary if LoadLog is refcounted thread safe. LoadLog itself is not thread safe -- however making its refcounting threadsafe simplifies passing it across thread boundaries. Initially I had avoided doing this, and instead was trying to be very careful in when callers would AddRef/Release to avoid races. This approach however turned out to be fragile, and it was difficult to chase down all of the dependencies (they just kept popping up). So now I am changing that decision, and opting for the simpler approach which will be much more robust. The performance impact should be negligable. BUG=22272 Review URL: http://codereview.chromium.org/347021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30525 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/host_resolver_impl.cc')
-rw-r--r--net/base/host_resolver_impl.cc13
1 files changed, 4 insertions, 9 deletions
diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc
index 47b2aa3..557d42a 100644
--- a/net/base/host_resolver_impl.cc
+++ b/net/base/host_resolver_impl.cc
@@ -75,9 +75,6 @@ class HostResolverImpl::Request {
job_ = NULL;
callback_ = NULL;
addresses_ = NULL;
- // Clear the LoadLog to make sure it won't be released later on the
- // worker thread. See http://crbug.com/22272
- load_log_ = NULL;
}
bool was_cancelled() const {
@@ -193,7 +190,7 @@ class HostResolverImpl::Job
}
// We will call HostResolverImpl::CancelRequest(Request*) on each one
- // in order to notify any observers, and also clear the LoadLog.
+ // in order to notify any observers.
for (RequestsList::const_iterator it = requests_.begin();
it != requests_.end(); ++it) {
HostResolverImpl::Request* req = *it;
@@ -410,11 +407,9 @@ void HostResolverImpl::CancelRequest(RequestHandle req_handle) {
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.
- scoped_refptr<LoadLog> load_log(req->load_log());
// NULL out the fields of req, to mark it as cancelled.
req->MarkAsCancelled();
- OnCancelRequest(load_log, req->id(), req->info());
+ OnCancelRequest(req->load_log(), req->id(), req->info());
}
void HostResolverImpl::AddObserver(Observer* observer) {
@@ -465,8 +460,8 @@ void HostResolverImpl::RemoveOutstandingJob(Job* job) {
}
void HostResolverImpl::OnJobComplete(Job* job,
- int error,
- const AddressList& addrlist) {
+ int error,
+ const AddressList& addrlist) {
RemoveOutstandingJob(job);
// Write result to the cache.