summaryrefslogtreecommitdiffstats
path: root/net/proxy/proxy_service.cc
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-24 08:26:46 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-24 08:26:46 +0000
commit7672247cf3de10b55378d0591bdd5970c17a7f31 (patch)
treeca71a66222a57afc352e44bb0cde5ba274137064 /net/proxy/proxy_service.cc
parentdf6f2e1db4e6478dc62b5aa11f33e845734e6717 (diff)
downloadchromium_src-7672247cf3de10b55378d0591bdd5970c17a7f31.zip
chromium_src-7672247cf3de10b55378d0591bdd5970c17a7f31.tar.gz
chromium_src-7672247cf3de10b55378d0591bdd5970c17a7f31.tar.bz2
Use SingleThreadTaskRunner instead of MessageLoopProxy in ProxyConfigService.
MessageLoopProxy is not usable in plugin, and so it's not possible to use ProxyConfigService in plugins if it uses MessageLoopProxy. Review URL: https://chromiumcodereview.appspot.com/10414061 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138751 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/proxy_service.cc')
-rw-r--r--net/proxy/proxy_service.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc
index 1c92033..3cd82a5 100644
--- a/net/proxy/proxy_service.cc
+++ b/net/proxy/proxy_service.cc
@@ -14,6 +14,7 @@
#include "base/message_loop.h"
#include "base/message_loop_proxy.h"
#include "base/string_util.h"
+#include "base/thread_task_runner_handle.h"
#include "base/values.h"
#include "googleurl/src/gurl.h"
#include "net/base/completion_callback.h"
@@ -1419,11 +1420,12 @@ void ProxyService::ForceReloadProxyConfig() {
// static
ProxyConfigService* ProxyService::CreateSystemProxyConfigService(
- MessageLoop* io_loop, MessageLoop* file_loop) {
+ base::SingleThreadTaskRunner* io_thread_task_runner,
+ MessageLoop* file_loop) {
#if defined(OS_WIN)
return new ProxyConfigServiceWin();
#elif defined(OS_MACOSX)
- return new ProxyConfigServiceMac(io_loop);
+ return new ProxyConfigServiceMac(io_thread_task_runner);
#elif defined(OS_CHROMEOS)
LOG(ERROR) << "ProxyConfigService for ChromeOS should be created in "
<< "profile_io_data.cc::CreateProxyConfigService and this should "
@@ -1433,10 +1435,11 @@ ProxyConfigService* ProxyService::CreateSystemProxyConfigService(
ProxyConfigServiceLinux* linux_config_service =
new ProxyConfigServiceLinux();
- // Assume we got called from the UI loop, which runs the default
- // glib main loop, so the current thread is where we should be
- // running gconf calls from.
- MessageLoop* glib_default_loop = MessageLoopForUI::current();
+ // Assume we got called on the thread that runs the default glib
+ // main loop, so the current thread is where we should be running
+ // gconf calls from.
+ scoped_refptr<base::SingleThreadTaskRunner> glib_thread_task_runner =
+ base::ThreadTaskRunnerHandle::Get();
// The file loop should be a MessageLoopForIO on Linux.
DCHECK_EQ(MessageLoop::TYPE_IO, file_loop->type());
@@ -1446,8 +1449,7 @@ ProxyConfigService* ProxyService::CreateSystemProxyConfigService(
// notifications (delivered in either |glib_default_loop| or
// |file_loop|) to keep us updated when the proxy config changes.
linux_config_service->SetupAndFetchInitialConfig(
- glib_default_loop->message_loop_proxy(),
- io_loop->message_loop_proxy(),
+ glib_thread_task_runner, io_thread_task_runner,
static_cast<MessageLoopForIO*>(file_loop));
return linux_config_service;