summaryrefslogtreecommitdiffstats
path: root/net/proxy
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-13 17:32:16 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-13 17:32:16 +0000
commitb8b33e56ef23ea4916a0c2826b81ae27a1ff80c3 (patch)
tree6fff86a967d01201a358a46d776756a2941e65ae /net/proxy
parent377b2d385b89aa568fbadf370636c30902f77760 (diff)
downloadchromium_src-b8b33e56ef23ea4916a0c2826b81ae27a1ff80c3.zip
chromium_src-b8b33e56ef23ea4916a0c2826b81ae27a1ff80c3.tar.gz
chromium_src-b8b33e56ef23ea4916a0c2826b81ae27a1ff80c3.tar.bz2
Make MultiThreadedProxyResolver resistant to crashes when leaked.
Sometimes ProfileIOData gets leaked on shutdown due to buggy code. If MultiThreadedProxyResolver doesn't get destroyed on shutdown, it can try to post to a MessageLoop that has already been destroyed, leading to a use after free crash. BUG=none TEST=none Review URL: http://codereview.chromium.org/7356012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92376 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy')
-rw-r--r--net/proxy/multi_threaded_proxy_resolver.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/net/proxy/multi_threaded_proxy_resolver.cc b/net/proxy/multi_threaded_proxy_resolver.cc
index 87e25b0..1618b2b 100644
--- a/net/proxy/multi_threaded_proxy_resolver.cc
+++ b/net/proxy/multi_threaded_proxy_resolver.cc
@@ -1,10 +1,10 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "net/proxy/multi_threaded_proxy_resolver.h"
-#include "base/message_loop.h"
+#include "base/message_loop_proxy.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/threading/thread.h"
@@ -146,7 +146,7 @@ class MultiThreadedProxyResolver::Job
// This method is called on the worker thread to do the job's work. On
// completion, implementors are expected to call OnJobCompleted() on
// |origin_loop|.
- virtual void Run(MessageLoop* origin_loop) = 0;
+ virtual void Run(scoped_refptr<base::MessageLoopProxy> origin_loop) = 0;
protected:
void OnJobCompleted() {
@@ -188,7 +188,7 @@ class MultiThreadedProxyResolver::SetPacScriptJob
}
// Runs on the worker thread.
- virtual void Run(MessageLoop* origin_loop) {
+ virtual void Run(scoped_refptr<base::MessageLoopProxy> origin_loop) {
ProxyResolver* resolver = executor()->resolver();
int rv = resolver->SetPacScript(script_data_, NULL);
@@ -253,7 +253,7 @@ class MultiThreadedProxyResolver::GetProxyForURLJob
}
// Runs on the worker thread.
- virtual void Run(MessageLoop* origin_loop) {
+ virtual void Run(scoped_refptr<base::MessageLoopProxy> origin_loop) {
ProxyResolver* resolver = executor()->resolver();
int rv = resolver->GetProxyForURL(
url_, &results_buf_, NULL, NULL, net_log_);
@@ -320,7 +320,8 @@ void MultiThreadedProxyResolver::Executor::StartJob(Job* job) {
job->FinishedWaitingForThread();
thread_->message_loop()->PostTask(
FROM_HERE,
- NewRunnableMethod(job, &Job::Run, MessageLoop::current()));
+ NewRunnableMethod(job, &Job::Run,
+ base::MessageLoopProxy::CreateForCurrentThread()));
}
void MultiThreadedProxyResolver::Executor::OnJobCompleted(Job* job) {