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

Unified Diff: webrtc/base/network.h

Issue 1391703003: Create network change notifier. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: 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
Index: webrtc/base/network.h
diff --git a/webrtc/base/network.h b/webrtc/base/network.h
index f365a7877262ed30c149daa15bfcf63bf07eac0a..f7b1de19648ae0211e35c4bc0ee2b7f00e862e89 100644
--- a/webrtc/base/network.h
+++ b/webrtc/base/network.h
@@ -29,6 +29,7 @@ struct ifaddrs;
namespace rtc {
class Network;
+class NetworkMonitor;
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 starts to listen to the update.
pthatcher1 2015/10/15 08:11:43 "and starts to listen to the update" => "and liste
honghaiz3 2015/10/15 19:02:41 Done.
+ void StartNetworkMonitor();
+ // Stops and removes the network monitor.
+ void StopNetworkMonitor();
+ // Called when it receives the update from the network monitor.
pthatcher1 2015/10/15 08:11:43 receives the update => receives updates
honghaiz3 2015/10/15 19:02:41 Done.
+ 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,8 @@ class BasicNetworkManager : public NetworkManagerBase,
std::vector<std::string> network_ignore_list_;
int network_ignore_mask_;
bool ignore_non_default_routes_;
+ // It monitors the network changes and it may be NULL if it is not injected.
pthatcher1 2015/10/15 08:11:43 "if it is not injected" is confusing, especially s
honghaiz3 2015/10/15 19:02:41 Done.
+ scoped_ptr<NetworkMonitor> network_monitor_;
};
// Represents a Unix-type network interface, with a name and single address.

Powered by Google App Engine
This is Rietveld 408576698