| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 sent_first_update_ = false; | 724 sent_first_update_ = false; |
| 725 StopNetworkMonitor(); | 725 StopNetworkMonitor(); |
| 726 } | 726 } |
| 727 } | 727 } |
| 728 | 728 |
| 729 void BasicNetworkManager::StartNetworkMonitor() { | 729 void BasicNetworkManager::StartNetworkMonitor() { |
| 730 NetworkMonitorFactory* factory = NetworkMonitorFactory::GetFactory(); | 730 NetworkMonitorFactory* factory = NetworkMonitorFactory::GetFactory(); |
| 731 if (factory == nullptr) { | 731 if (factory == nullptr) { |
| 732 return; | 732 return; |
| 733 } | 733 } |
| 734 network_monitor_.reset(factory->CreateNetworkMonitor()); | |
| 735 if (!network_monitor_) { | 734 if (!network_monitor_) { |
| 736 return; | 735 network_monitor_.reset(factory->CreateNetworkMonitor()); |
| 736 if (!network_monitor_) { |
| 737 return; |
| 738 } |
| 737 } | 739 } |
| 740 |
| 738 network_monitor_->SignalNetworksChanged.connect( | 741 network_monitor_->SignalNetworksChanged.connect( |
| 739 this, &BasicNetworkManager::OnNetworksChanged); | 742 this, &BasicNetworkManager::OnNetworksChanged); |
| 740 network_monitor_->Start(); | 743 network_monitor_->Start(); |
| 741 } | 744 } |
| 742 | 745 |
| 743 void BasicNetworkManager::StopNetworkMonitor() { | 746 void BasicNetworkManager::StopNetworkMonitor() { |
| 744 if (!network_monitor_) { | 747 if (!network_monitor_) { |
| 745 return; | 748 return; |
| 746 } | 749 } |
| 747 network_monitor_->Stop(); | 750 network_monitor_->Stop(); |
| 748 network_monitor_.reset(); | |
| 749 } | 751 } |
| 750 | 752 |
| 751 void BasicNetworkManager::OnMessage(Message* msg) { | 753 void BasicNetworkManager::OnMessage(Message* msg) { |
| 752 switch (msg->message_id) { | 754 switch (msg->message_id) { |
| 753 case kUpdateNetworksMessage: { | 755 case kUpdateNetworksMessage: { |
| 754 UpdateNetworksContinually(); | 756 UpdateNetworksContinually(); |
| 755 break; | 757 break; |
| 756 } | 758 } |
| 757 case kSignalNetworksMessage: { | 759 case kSignalNetworksMessage: { |
| 758 SignalNetworksChanged(); | 760 SignalNetworksChanged(); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 std::stringstream ss; | 914 std::stringstream ss; |
| 913 // Print out the first space-terminated token of the network desc, plus | 915 // Print out the first space-terminated token of the network desc, plus |
| 914 // the IP address. | 916 // the IP address. |
| 915 ss << "Net[" << description_.substr(0, description_.find(' ')) | 917 ss << "Net[" << description_.substr(0, description_.find(' ')) |
| 916 << ":" << prefix_.ToSensitiveString() << "/" << prefix_length_ | 918 << ":" << prefix_.ToSensitiveString() << "/" << prefix_length_ |
| 917 << ":" << AdapterTypeToString(type_) << "]"; | 919 << ":" << AdapterTypeToString(type_) << "]"; |
| 918 return ss.str(); | 920 return ss.str(); |
| 919 } | 921 } |
| 920 | 922 |
| 921 } // namespace rtc | 923 } // namespace rtc |
| OLD | NEW |