summaryrefslogtreecommitdiffstats
path: root/net/proxy/single_threaded_proxy_resolver.cc
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-17 00:07:04 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-17 00:07:04 +0000
commit1ca2b45a6e0b6490d0ab1ff940e2d7769660682b (patch)
treef6740d35ae7bf87007f6794a49f53f2858ead7b7 /net/proxy/single_threaded_proxy_resolver.cc
parent54ce726e1af62939cb12b09dc687737b114d426c (diff)
downloadchromium_src-1ca2b45a6e0b6490d0ab1ff940e2d7769660682b.zip
chromium_src-1ca2b45a6e0b6490d0ab1ff940e2d7769660682b.tar.gz
chromium_src-1ca2b45a6e0b6490d0ab1ff940e2d7769660682b.tar.bz2
Fix a deadlock that could happen during shutdown if a host resolve request was outstanding by a PAC script.
The solution is to abort the oustanding host resolver request during shutdown, and wake-up the blocked PAC thread. BUG=41244 TEST=SingleThreadedProxyResolverWithBridgedHostResolverTest.ShutdownDeadlock Review URL: http://codereview.chromium.org/1527037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44864 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/single_threaded_proxy_resolver.cc')
-rw-r--r--net/proxy/single_threaded_proxy_resolver.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/net/proxy/single_threaded_proxy_resolver.cc b/net/proxy/single_threaded_proxy_resolver.cc
index 4009e2a..b0fd4a3 100644
--- a/net/proxy/single_threaded_proxy_resolver.cc
+++ b/net/proxy/single_threaded_proxy_resolver.cc
@@ -156,22 +156,23 @@ class SingleThreadedProxyResolver::Job
// Runs on the worker thread.
void DoQuery(ProxyResolver* resolver, size_t load_log_bound) {
- scoped_ptr<CapturingNetLog> worker_log(new CapturingNetLog(load_log_bound));
- BoundNetLog bound_worker_log(NetLog::Source(), worker_log.get());
+ worker_log_.reset(new CapturingNetLog(load_log_bound));
+ BoundNetLog bound_worker_log(NetLog::Source(), worker_log_.get());
int rv = resolver->GetProxyForURL(url_, &results_buf_, NULL, NULL,
bound_worker_log);
DCHECK_NE(rv, ERR_IO_PENDING);
origin_loop_->PostTask(FROM_HERE,
- NewRunnableMethod(this, &Job::QueryComplete, rv, worker_log.release()));
+ NewRunnableMethod(this, &Job::QueryComplete, rv));
}
// Runs the completion callback on the origin thread.
- void QueryComplete(int result_code, CapturingNetLog* worker_log) {
+ void QueryComplete(int result_code) {
// Merge the load log that was generated on the worker thread, into the
// main log.
- CapturingBoundNetLog bound_worker_log(NetLog::Source(), worker_log);
+ CapturingBoundNetLog bound_worker_log(NetLog::Source(),
+ worker_log_.release());
bound_worker_log.AppendTo(net_log_);
// The Job may have been cancelled after it was started.
@@ -199,6 +200,10 @@ class SingleThreadedProxyResolver::Job
// Usable from within DoQuery on the worker thread.
ProxyInfo results_buf_;
MessageLoop* origin_loop_;
+
+ // Used to pass the captured events between DoQuery [worker thread] and
+ // QueryComplete [origin thread].
+ scoped_ptr<CapturingNetLog> worker_log_;
};
// SingleThreadedProxyResolver ------------------------------------------------