Revert "Reland "Pass NetworkMonitorFactory through PeerConnectionFactory.""
This reverts commit 7ded73351870bfb45160fa6b9db71a94fe49397b. Reason for revert: Found more code calling NetworkMonitorFactory::SetFactory... Original change's description: > Reland "Pass NetworkMonitorFactory through PeerConnectionFactory." > > This is a reland of 003c9be817817ed0e3aef3f50c78ae5cb31bc0ff > > Original change's description: > > Pass NetworkMonitorFactory through PeerConnectionFactory. > > > > Previously the instance was set through a static method, which was > > really only done because it was difficult to add new > > PeerConnectionFactory construction arguments at the time. > > > > Now that we have PeerConnectionFactoryDependencies it's easy to clean > > this up. > > > > I'm doing this because I plan to add a NetworkMonitor implementation > > for iOS, and don't want to inherit this ugliness. > > > > Bug: webrtc:9883 > > Change-Id: Id94dc061ab1c7186b81af8547393a6e336ff04c2 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/180241 > > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > > Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> > > Commit-Queue: Taylor <deadbeef@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#31815} > > TBR=hta@webrtc.org, sakal@webrtc.org > > Bug: webrtc:9883 > Change-Id: Ibf69a22e8f94226908636c7d50ff9eda65bd4129 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/180720 > Reviewed-by: Taylor <deadbeef@webrtc.org> > Commit-Queue: Taylor <deadbeef@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#31822} TBR=deadbeef@webrtc.org,sakal@webrtc.org,hta@webrtc.org Change-Id: Iae51b94072cec9abc021eed4e51d1fbeee998adc No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:9883 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/180721 Reviewed-by: Taylor <deadbeef@webrtc.org> Commit-Queue: Taylor <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31823}
This commit is contained in:
@ -470,16 +470,12 @@ Network* NetworkManagerBase::GetNetworkFromAddress(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BasicNetworkManager::BasicNetworkManager() {}
|
||||
|
||||
BasicNetworkManager::BasicNetworkManager(
|
||||
NetworkMonitorFactory* network_monitor_factory)
|
||||
: network_monitor_factory_(network_monitor_factory) {}
|
||||
BasicNetworkManager::BasicNetworkManager()
|
||||
: thread_(nullptr), sent_first_update_(false), start_count_(0) {}
|
||||
|
||||
BasicNetworkManager::~BasicNetworkManager() {}
|
||||
|
||||
void BasicNetworkManager::OnNetworksChanged() {
|
||||
RTC_DCHECK_RUN_ON(thread_);
|
||||
RTC_LOG(LS_INFO) << "Network change was observed";
|
||||
UpdateNetworksOnce();
|
||||
}
|
||||
@ -803,8 +799,6 @@ bool BasicNetworkManager::IsIgnoredNetwork(const Network& network) const {
|
||||
|
||||
void BasicNetworkManager::StartUpdating() {
|
||||
thread_ = Thread::Current();
|
||||
// Redundant but necessary for thread annotations.
|
||||
RTC_DCHECK_RUN_ON(thread_);
|
||||
if (start_count_) {
|
||||
// If network interfaces are already discovered and signal is sent,
|
||||
// we should trigger network signal immediately for the new clients
|
||||
@ -819,7 +813,7 @@ void BasicNetworkManager::StartUpdating() {
|
||||
}
|
||||
|
||||
void BasicNetworkManager::StopUpdating() {
|
||||
RTC_DCHECK_RUN_ON(thread_);
|
||||
RTC_DCHECK(Thread::Current() == thread_);
|
||||
if (!start_count_)
|
||||
return;
|
||||
|
||||
@ -832,11 +826,12 @@ void BasicNetworkManager::StopUpdating() {
|
||||
}
|
||||
|
||||
void BasicNetworkManager::StartNetworkMonitor() {
|
||||
if (network_monitor_factory_ == nullptr) {
|
||||
NetworkMonitorFactory* factory = NetworkMonitorFactory::GetFactory();
|
||||
if (factory == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (!network_monitor_) {
|
||||
network_monitor_.reset(network_monitor_factory_->CreateNetworkMonitor());
|
||||
network_monitor_.reset(factory->CreateNetworkMonitor());
|
||||
if (!network_monitor_) {
|
||||
return;
|
||||
}
|
||||
@ -854,7 +849,6 @@ void BasicNetworkManager::StopNetworkMonitor() {
|
||||
}
|
||||
|
||||
void BasicNetworkManager::OnMessage(Message* msg) {
|
||||
RTC_DCHECK_RUN_ON(thread_);
|
||||
switch (msg->message_id) {
|
||||
case kUpdateNetworksMessage: {
|
||||
UpdateNetworksContinually();
|
||||
@ -870,6 +864,7 @@ void BasicNetworkManager::OnMessage(Message* msg) {
|
||||
}
|
||||
|
||||
IPAddress BasicNetworkManager::QueryDefaultLocalAddress(int family) const {
|
||||
RTC_DCHECK(thread_ == Thread::Current());
|
||||
RTC_DCHECK(thread_->socketserver() != nullptr);
|
||||
RTC_DCHECK(family == AF_INET || family == AF_INET6);
|
||||
|
||||
@ -898,6 +893,8 @@ void BasicNetworkManager::UpdateNetworksOnce() {
|
||||
if (!start_count_)
|
||||
return;
|
||||
|
||||
RTC_DCHECK(Thread::Current() == thread_);
|
||||
|
||||
NetworkList list;
|
||||
if (!CreateNetworks(false, &list)) {
|
||||
SignalError();
|
||||
@ -921,7 +918,6 @@ void BasicNetworkManager::UpdateNetworksContinually() {
|
||||
}
|
||||
|
||||
void BasicNetworkManager::DumpNetworks() {
|
||||
RTC_DCHECK_RUN_ON(thread_);
|
||||
NetworkList list;
|
||||
GetNetworks(&list);
|
||||
RTC_LOG(LS_INFO) << "NetworkManager detected " << list.size() << " networks:";
|
||||
|
||||
Reference in New Issue
Block a user