diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-24 08:26:46 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-24 08:26:46 +0000 |
commit | 7672247cf3de10b55378d0591bdd5970c17a7f31 (patch) | |
tree | ca71a66222a57afc352e44bb0cde5ba274137064 /net/proxy/proxy_config_service_mac.cc | |
parent | df6f2e1db4e6478dc62b5aa11f33e845734e6717 (diff) | |
download | chromium_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_config_service_mac.cc')
-rw-r--r-- | net/proxy/proxy_config_service_mac.cc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/net/proxy/proxy_config_service_mac.cc b/net/proxy/proxy_config_service_mac.cc index a3b2f2b..7c4b8bf 100644 --- a/net/proxy/proxy_config_service_mac.cc +++ b/net/proxy/proxy_config_service_mac.cc @@ -185,17 +185,18 @@ class ProxyConfigServiceMac::Helper ProxyConfigServiceMac* parent_; }; -ProxyConfigServiceMac::ProxyConfigServiceMac(MessageLoop* io_loop) +ProxyConfigServiceMac::ProxyConfigServiceMac( + base::SingleThreadTaskRunner* io_thread_task_runner) : forwarder_(this), has_fetched_config_(false), helper_(new Helper(this)), - io_loop_(io_loop) { - DCHECK(io_loop); + io_thread_task_runner_(io_thread_task_runner) { + DCHECK(io_thread_task_runner_); config_watcher_.reset(new NetworkConfigWatcherMac(&forwarder_)); } ProxyConfigServiceMac::~ProxyConfigServiceMac() { - DCHECK_EQ(io_loop_, MessageLoop::current()); + DCHECK(io_thread_task_runner_->BelongsToCurrentThread()); // Delete the config_watcher_ to ensure the notifier thread finishes before // this object is destroyed. config_watcher_.reset(); @@ -203,18 +204,18 @@ ProxyConfigServiceMac::~ProxyConfigServiceMac() { } void ProxyConfigServiceMac::AddObserver(Observer* observer) { - DCHECK_EQ(io_loop_, MessageLoop::current()); + DCHECK(io_thread_task_runner_->BelongsToCurrentThread()); observers_.AddObserver(observer); } void ProxyConfigServiceMac::RemoveObserver(Observer* observer) { - DCHECK_EQ(io_loop_, MessageLoop::current()); + DCHECK(io_thread_task_runner_->BelongsToCurrentThread()); observers_.RemoveObserver(observer); } net::ProxyConfigService::ConfigAvailability ProxyConfigServiceMac::GetLatestProxyConfig(ProxyConfig* config) { - DCHECK_EQ(io_loop_, MessageLoop::current()); + DCHECK(io_thread_task_runner_->BelongsToCurrentThread()); // Lazy-initialize by fetching the proxy setting from this thread. if (!has_fetched_config_) { @@ -250,14 +251,14 @@ void ProxyConfigServiceMac::OnNetworkConfigChange(CFArrayRef changed_keys) { GetCurrentProxyConfig(&new_config); // Call OnProxyConfigChanged() on the IO thread to notify our observers. - io_loop_->PostTask( + io_thread_task_runner_->PostTask( FROM_HERE, base::Bind(&Helper::OnProxyConfigChanged, helper_.get(), new_config)); } void ProxyConfigServiceMac::OnProxyConfigChanged( const ProxyConfig& new_config) { - DCHECK_EQ(io_loop_, MessageLoop::current()); + DCHECK(io_thread_task_runner_->BelongsToCurrentThread()); // Keep track of the last value we have seen. has_fetched_config_ = true; |