Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Unified Diff: net/base/network_change_notifier_mac.cc

Issue 10873018: [net] Move DnsConfigService to NetworkChangeNotifier. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add comment Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/network_change_notifier_mac.h ('k') | net/base/network_change_notifier_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/network_change_notifier_mac.cc
diff --git a/net/base/network_change_notifier_mac.cc b/net/base/network_change_notifier_mac.cc
index 1d9197ed4080515bf4c81beb31a38e876db28a3a..515cbd0303397ba4b4bae44d3a0d22aa0e5ed060 100644
--- a/net/base/network_change_notifier_mac.cc
+++ b/net/base/network_change_notifier_mac.cc
@@ -9,11 +9,7 @@
#include "base/basictypes.h"
#include "base/threading/thread.h"
-#include "net/dns/dns_config_watcher.h"
-
-#ifndef _PATH_RESCONF // Normally defined in <resolv.h>
-#define _PATH_RESCONF "/etc/resolv.conf"
-#endif
+#include "net/dns/dns_config_service.h"
namespace net {
@@ -41,26 +37,29 @@ NetworkChangeNotifier::ConnectionType CalculateConnectionType(
}
}
-class NetworkChangeNotifierMac::DnsWatcherThread : public base::Thread {
+// Thread on which we can run DnsConfigService, which requires a TYPE_IO
+// message loop.
+class NetworkChangeNotifierMac::DnsConfigServiceThread : public base::Thread {
public:
- DnsWatcherThread() : base::Thread("DnsWatcher") {}
+ DnsConfigServiceThread() : base::Thread("DnsConfigService") {}
- virtual ~DnsWatcherThread() {
+ virtual ~DnsConfigServiceThread() {
Stop();
}
virtual void Init() OVERRIDE {
- watcher_.Init();
+ service_ = DnsConfigService::CreateSystemService();
+ service_->WatchConfig(base::Bind(&NetworkChangeNotifier::SetDnsConfig));
}
virtual void CleanUp() OVERRIDE {
- watcher_.CleanUp();
+ service_.reset();
}
private:
- internal::DnsConfigWatcher watcher_;
+ scoped_ptr<DnsConfigService> service_;
- DISALLOW_COPY_AND_ASSIGN(DnsWatcherThread);
+ DISALLOW_COPY_AND_ASSIGN(DnsConfigServiceThread);
};
NetworkChangeNotifierMac::NetworkChangeNotifierMac()
@@ -68,12 +67,12 @@ NetworkChangeNotifierMac::NetworkChangeNotifierMac()
connection_type_initialized_(false),
initial_connection_type_cv_(&connection_type_lock_),
forwarder_(this),
- dns_watcher_thread_(new DnsWatcherThread()) {
+ dns_config_service_thread_(new DnsConfigServiceThread()) {
// Must be initialized after the rest of this object, as it may call back into
// SetInitialConnectionType().
config_watcher_.reset(new NetworkConfigWatcherMac(&forwarder_));
- dns_watcher_thread_->StartWithOptions(
- base::Thread::Options(MessageLoop::TYPE_IO, 0));
+ dns_config_service_thread_->StartWithOptions(
+ base::Thread::Options(MessageLoop::TYPE_IO, 0));
}
NetworkChangeNotifierMac::~NetworkChangeNotifierMac() {
« no previous file with comments | « net/base/network_change_notifier_mac.h ('k') | net/base/network_change_notifier_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698