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

Unified Diff: webrtc/base/network.h

Issue 1391703003: Create network change notifier. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Changed comments Created 5 years, 2 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 | « webrtc/base/base.gyp ('k') | webrtc/base/network.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/network.h
diff --git a/webrtc/base/network.h b/webrtc/base/network.h
index f365a7877262ed30c149daa15bfcf63bf07eac0a..ab3a88dc7dc0c4dd511d5da7aee4b7c035975657 100644
--- a/webrtc/base/network.h
+++ b/webrtc/base/network.h
@@ -29,6 +29,7 @@ struct ifaddrs;
namespace rtc {
class Network;
+class NetworkMonitorInterface;
class Thread;
enum AdapterType {
@@ -147,7 +148,6 @@ class NetworkManagerBase : public NetworkManager {
private:
friend class NetworkTest;
- void DoUpdateNetworks();
EnumerationPermission enumeration_permission_;
@@ -164,7 +164,8 @@ class NetworkManagerBase : public NetworkManager {
// Basic implementation of the NetworkManager interface that gets list
// of networks using OS APIs.
class BasicNetworkManager : public NetworkManagerBase,
- public MessageHandler {
+ public MessageHandler,
+ public sigslot::has_slots<> {
public:
BasicNetworkManager();
~BasicNetworkManager() override;
@@ -222,7 +223,17 @@ class BasicNetworkManager : public NetworkManagerBase,
private:
friend class NetworkTest;
- void DoUpdateNetworks();
+ // Creates a network monitor and listens for network updates.
+ void StartNetworkMonitor();
+ // Stops and removes the network monitor.
+ void StopNetworkMonitor();
+ // Called when it receives updates from the network monitor.
+ void OnNetworksChanged();
+
+ // Updates the networks and reschedules the next update.
+ void UpdateNetworksContinually();
+ // Only updates the networks; does not reschedule the next update.
+ void UpdateNetworksOnce();
Thread* thread_;
bool sent_first_update_;
@@ -230,6 +241,7 @@ class BasicNetworkManager : public NetworkManagerBase,
std::vector<std::string> network_ignore_list_;
int network_ignore_mask_;
bool ignore_non_default_routes_;
+ scoped_ptr<NetworkMonitorInterface> network_monitor_;
};
// Represents a Unix-type network interface, with a name and single address.
« no previous file with comments | « webrtc/base/base.gyp ('k') | webrtc/base/network.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698