diff options
Diffstat (limited to 'chrome/common/net')
-rw-r--r-- | chrome/common/net/network_change_notifier_proxy.cc | 18 | ||||
-rw-r--r-- | chrome/common/net/network_change_notifier_proxy.h | 11 |
2 files changed, 12 insertions, 17 deletions
diff --git a/chrome/common/net/network_change_notifier_proxy.cc b/chrome/common/net/network_change_notifier_proxy.cc index 8a25d22..a0a1961 100644 --- a/chrome/common/net/network_change_notifier_proxy.cc +++ b/chrome/common/net/network_change_notifier_proxy.cc @@ -15,13 +15,6 @@ NetworkChangeNotifierProxy::NetworkChangeNotifierProxy( : observer_proxy_(new NetworkChangeObserverProxy( source_thread, MessageLoop::current())), observer_repeater_(&observers_) { - // TODO(akalin): We get this from NonThreadSafe, which - // net::NetworkChangeNotifier inherits from. Interface classes - // really shouldn't be inheriting from NonThreadSafe; make it so - // that all the implementations of net::NetworkChangeNotifier - // inherit from NonThreadSafe directly and - // net::NetworkChangeNotifier doesn't. - DCHECK(CalledOnValidThread()); DCHECK(observer_proxy_); observer_proxy_->Attach(&observer_repeater_); } @@ -44,16 +37,19 @@ void NetworkChangeNotifierProxy::RemoveObserver( } NetworkChangeNotifierProxy::ObserverRepeater::ObserverRepeater( - NetworkObserverList* observers) : observers_(observers) { + NetworkObserverList* observers) + : observers_(observers) { DCHECK(observers_); } -NetworkChangeNotifierProxy::ObserverRepeater::~ObserverRepeater() {} +NetworkChangeNotifierProxy::ObserverRepeater::~ObserverRepeater() { + DCHECK(CalledOnValidThread()); +} void NetworkChangeNotifierProxy::ObserverRepeater::OnIPAddressChanged() { DCHECK(CalledOnValidThread()); - FOR_EACH_OBSERVER(net::NetworkChangeNotifier::Observer, - *observers_, OnIPAddressChanged()); + FOR_EACH_OBSERVER(net::NetworkChangeNotifier::Observer, *observers_, + OnIPAddressChanged()); } } // namespace chrome_common_net diff --git a/chrome/common/net/network_change_notifier_proxy.h b/chrome/common/net/network_change_notifier_proxy.h index 916d5f8..7ed01a8 100644 --- a/chrome/common/net/network_change_notifier_proxy.h +++ b/chrome/common/net/network_change_notifier_proxy.h @@ -21,19 +21,18 @@ namespace chrome_common_net { class NetworkChangeNotifierThread; class NetworkChangeObserverProxy; -class NetworkChangeNotifierProxy : public net::NetworkChangeNotifier { +class NetworkChangeNotifierProxy : public net::NetworkChangeNotifier, + public NonThreadSafe { public: // |source_thread| must be guaranteed to outlive the current thread. // Does not take ownership of any arguments. - NetworkChangeNotifierProxy( + explicit NetworkChangeNotifierProxy( NetworkChangeNotifierThread* source_thread); virtual ~NetworkChangeNotifierProxy(); // net::NetworkChangeNotifier implementation. - virtual void AddObserver(net::NetworkChangeNotifier::Observer* observer); - virtual void RemoveObserver(net::NetworkChangeNotifier::Observer* observer); private: @@ -42,8 +41,8 @@ class NetworkChangeNotifierProxy : public net::NetworkChangeNotifier { // Utility class that routes received notifications to a list of // observers. - class ObserverRepeater : public NonThreadSafe, - public net::NetworkChangeNotifier::Observer { + class ObserverRepeater : public net::NetworkChangeNotifier::Observer, + public NonThreadSafe { public: // Does not take ownership of the given observer list. explicit ObserverRepeater(NetworkObserverList* observers); |