diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-24 22:41:47 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-24 22:41:47 +0000 |
commit | 6531594abea873c883782041fea5d126507497e1 (patch) | |
tree | 017227faab41fb16f84a2485ec9b03d3f783d132 /net/base/network_change_notifier_mac.h | |
parent | 60a782e6a5a80fbba8fe690f05502147ae998d8c (diff) | |
download | chromium_src-6531594abea873c883782041fea5d126507497e1.zip chromium_src-6531594abea873c883782041fea5d126507497e1.tar.gz chromium_src-6531594abea873c883782041fea5d126507497e1.tar.bz2 |
Switch NetworkChangeNotifier implementations to use ObserverList.
Fix up observer list so we can use FOR_EACH_OBSERVER when check_empty is set.
Clean up the ObserverList API a bit, replacing GetElementAt() with HasObserver() and Clear().
BUG=36590
Review URL: http://codereview.chromium.org/652205
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39942 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/network_change_notifier_mac.h')
-rw-r--r-- | net/base/network_change_notifier_mac.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/net/base/network_change_notifier_mac.h b/net/base/network_change_notifier_mac.h index 5e777f4..44d4806 100644 --- a/net/base/network_change_notifier_mac.h +++ b/net/base/network_change_notifier_mac.h @@ -6,11 +6,11 @@ #define NET_BASE_NETWORK_CHANGE_NOTIFIER_MAC_H_ #include "base/basictypes.h" +#include "base/observer_list.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" #include "base/task.h" #include "net/base/network_change_notifier.h" -#include "net/base/network_change_notifier_helper.h" class MessageLoop; namespace base { @@ -23,16 +23,18 @@ class NetworkChangeNotifierMac : public NetworkChangeNotifier { public: NetworkChangeNotifierMac(); - void OnIPAddressChanged() { helper_.OnIPAddressChanged(); } + void OnIPAddressChanged() { + FOR_EACH_OBSERVER(Observer, observers_, OnIPAddressChanged()); + } // NetworkChangeNotifier methods: virtual void AddObserver(Observer* observer) { - helper_.AddObserver(observer); + observers_.AddObserver(observer); } virtual void RemoveObserver(Observer* observer) { - helper_.RemoveObserver(observer); + observers_.RemoveObserver(observer); } private: @@ -49,7 +51,9 @@ class NetworkChangeNotifierMac : public NetworkChangeNotifier { // Receives the OS X network change notifications on this thread. scoped_ptr<base::Thread> notifier_thread_; - internal::NetworkChangeNotifierHelper helper_; + // TODO(willchan): Fix the URLRequestContextGetter leaks and flip the false to + // true so we assert that all observers have been removed. + ObserverList<Observer, false> observers_; // Used to initialize the notifier thread. ScopedRunnableMethodFactory<NetworkChangeNotifierMac> method_factory_; |