Index: net/base/network_change_notifier_linux.h |
=================================================================== |
--- net/base/network_change_notifier_linux.h (revision 50775) |
+++ net/base/network_change_notifier_linux.h (working copy) |
@@ -5,40 +5,35 @@ |
#ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_LINUX_H_ |
#define NET_BASE_NETWORK_CHANGE_NOTIFIER_LINUX_H_ |
-#include "base/basictypes.h" |
#include "base/message_loop.h" |
-#include "base/non_thread_safe.h" |
-#include "base/observer_list.h" |
#include "net/base/network_change_notifier.h" |
-#if defined(OS_CHROMEOS) |
-#include "base/task.h" |
-#endif |
+namespace base { |
+class Thread; |
+} |
namespace net { |
-class NetworkChangeNotifierLinux |
- : public NetworkChangeNotifier, |
- public NonThreadSafe, |
- public MessageLoopForIO::Watcher, |
- public MessageLoop::DestructionObserver { |
+class NetworkChangeNotifierLinux : public MessageLoop::DestructionObserver, |
+ public MessageLoopForIO::Watcher, |
+ public NetworkChangeNotifier { |
public: |
NetworkChangeNotifierLinux(); |
- // NetworkChangeNotifier methods: |
- virtual void AddObserver(Observer* observer); |
- virtual void RemoveObserver(Observer* observer); |
+ private: |
+ virtual ~NetworkChangeNotifierLinux(); |
- // MessageLoopForIO::Watcher methods: |
+ // MessageLoop::DestructionObserver: |
willchan no longer on Chromium
2010/06/25 15:36:22
There's no clear style consensus on this anywhere,
Peter Kasting
2010/06/25 17:51:33
I don't feel violently. It seems like a slight pl
willchan no longer on Chromium
2010/06/25 19:09:29
Yeah, it's the confusion, because it can be mislea
|
+ virtual void WillDestroyCurrentMessageLoop(); |
+ |
+ // MessageLoopForIO::Watcher: |
virtual void OnFileCanReadWithoutBlocking(int fd); |
virtual void OnFileCanWriteWithoutBlocking(int /* fd */); |
- // MessageLoop::DestructionObserver methods: |
- virtual void WillDestroyCurrentMessageLoop(); |
+ // Called on the notifier thread to initialize the notification |
+ // implementation. |
+ void Init(); |
- private: |
- virtual ~NetworkChangeNotifierLinux(); |
- |
// Starts listening for netlink messages. Also handles the messages if there |
// are any available on the netlink socket. |
void ListenForNotifications(); |
@@ -48,21 +43,14 @@ |
// recv() would block. Otherwise, it returns a net error code. |
int ReadNotificationMessage(char* buf, size_t len); |
- // Stops watching the netlink file descriptor. |
- void StopWatching(); |
+ // The thread used to listen for notifications. This relays the notification |
+ // to the registered observers without posting back to the thread the object |
+ // was created on. |
+ scoped_ptr<base::Thread> notifier_thread_; |
willchan no longer on Chromium
2010/06/25 15:36:22
You are deleting includes and neglecting to includ
Peter Kasting
2010/06/25 17:51:33
Wait, what did I delete here? base::Thread is dec
willchan no longer on Chromium
2010/06/25 19:09:29
You've deleted basictypes.h, which IIRC is require
Peter Kasting
2010/06/25 20:01:37
Oh, oops. Fixed in all the network_change_notifie
|
- void NotifyObserversIPAddressChanged(); |
+ // The netlink socket descriptor. |
+ int netlink_fd_; |
- // http://crbug.com/36890. |
- ObserverList<Observer, false> observers_; |
- |
- int netlink_fd_; // This is the netlink socket descriptor. |
- |
-#if defined(OS_CHROMEOS) |
- ScopedRunnableMethodFactory<NetworkChangeNotifierLinux> factory_; |
-#endif |
- |
- MessageLoopForIO* loop_; |
MessageLoopForIO::FileDescriptorWatcher netlink_watcher_; |
DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierLinux); |