diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-03 19:06:01 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-03 19:06:01 +0000 |
commit | 9715b85f74e95db5345fd33ef43ff48eb0ce983f (patch) | |
tree | 4db4724ac54f5e6a37d0cd6f42e2159e69db4d54 /net/proxy | |
parent | 1cfb7420fb7ea2fa5a6360bbee5424918e84a027 (diff) | |
download | chromium_src-9715b85f74e95db5345fd33ef43ff48eb0ce983f.zip chromium_src-9715b85f74e95db5345fd33ef43ff48eb0ce983f.tar.gz chromium_src-9715b85f74e95db5345fd33ef43ff48eb0ce983f.tar.bz2 |
Fix NetworkChangeNotifier crashes on Mac.
Revert r58230.
BUG=54305,53138
TEST=Make sure ethernet is plugged in. Run Chrome. Unplug ethernet. Does not crash.
Review URL: http://codereview.chromium.org/3350009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58520 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy')
-rw-r--r-- | net/proxy/proxy_config_service_mac.cc | 6 | ||||
-rw-r--r-- | net/proxy/proxy_config_service_mac.h | 35 |
2 files changed, 8 insertions, 33 deletions
diff --git a/net/proxy/proxy_config_service_mac.cc b/net/proxy/proxy_config_service_mac.cc index a197313..84a5da3 100644 --- a/net/proxy/proxy_config_service_mac.cc +++ b/net/proxy/proxy_config_service_mac.cc @@ -186,9 +186,7 @@ class ProxyConfigServiceMac::Helper }; ProxyConfigServiceMac::ProxyConfigServiceMac(MessageLoop* io_loop) - : forwarder_(this), - config_watcher_(&forwarder_), - has_fetched_config_(false), + : has_fetched_config_(false), helper_(new Helper(this)), io_loop_(io_loop) { DCHECK(io_loop); @@ -225,8 +223,6 @@ bool ProxyConfigServiceMac::GetLatestProxyConfig(ProxyConfig* config) { void ProxyConfigServiceMac::SetDynamicStoreNotificationKeys( SCDynamicStoreRef store) { - // Called on notifier thread. - CFStringRef proxies_key = SCDynamicStoreKeyCreateProxies(NULL); CFArrayRef key_array = CFArrayCreate( NULL, (const void **)(&proxies_key), 1, &kCFTypeArrayCallBacks); diff --git a/net/proxy/proxy_config_service_mac.h b/net/proxy/proxy_config_service_mac.h index ede8c5e..fd2d524 100644 --- a/net/proxy/proxy_config_service_mac.h +++ b/net/proxy/proxy_config_service_mac.h @@ -15,7 +15,8 @@ namespace net { -class ProxyConfigServiceMac : public ProxyConfigService { +class ProxyConfigServiceMac : public ProxyConfigService, + public NetworkConfigWatcherMac { public: // Constructs a ProxyConfigService that watches the Mac OS system settings. // This instance is expected to be operated and deleted on |io_loop| @@ -29,39 +30,17 @@ class ProxyConfigServiceMac : public ProxyConfigService { virtual void RemoveObserver(Observer* observer); virtual bool GetLatestProxyConfig(ProxyConfig* config); + protected: + // NetworkConfigWatcherMac implementation: + virtual void SetDynamicStoreNotificationKeys(SCDynamicStoreRef store); + virtual void OnNetworkConfigChange(CFArrayRef changed_keys); + private: class Helper; - // Forwarder just exists to keep the NetworkConfigWatcherMac API out of - // ProxyConfigServiceMac's public API. - class Forwarder : public NetworkConfigWatcherMac::Delegate { - public: - explicit Forwarder(ProxyConfigServiceMac* net_config_watcher) - : net_config_watcher_(net_config_watcher_) {} - - // NetworkConfigWatcherMac::Delegate implementation: - virtual void SetDynamicStoreNotificationKeys(SCDynamicStoreRef store) { - net_config_watcher_->SetDynamicStoreNotificationKeys(store); - } - virtual void OnNetworkConfigChange(CFArrayRef changed_keys) { - net_config_watcher_->OnNetworkConfigChange(changed_keys); - } - - private: - ProxyConfigServiceMac* const net_config_watcher_; - DISALLOW_COPY_AND_ASSIGN(Forwarder); - }; - - // NetworkConfigWatcherMac::Delegate implementation: - void SetDynamicStoreNotificationKeys(SCDynamicStoreRef store); - void OnNetworkConfigChange(CFArrayRef changed_keys); - // Called when the proxy configuration has changed, to notify the observers. void OnProxyConfigChanged(const ProxyConfig& new_config); - Forwarder forwarder_; - const NetworkConfigWatcherMac config_watcher_; - ObserverList<Observer> observers_; // Holds the last system proxy settings that we fetched. |