diff --git a/p2p/client/basic_port_allocator.cc b/p2p/client/basic_port_allocator.cc index 3e8ddf4b69..75213df1c0 100644 --- a/p2p/client/basic_port_allocator.cc +++ b/p2p/client/basic_port_allocator.cc @@ -188,23 +188,6 @@ BasicPortAllocator::BasicPortAllocator( webrtc::NO_PRUNE, customizer); } -BasicPortAllocator::BasicPortAllocator( - rtc::NetworkManager* network_manager, - rtc::PacketSocketFactory* socket_factory, - const ServerAddresses& stun_servers, - const webrtc::FieldTrialsView* field_trials) - : field_trials_(field_trials), - network_manager_(network_manager), - socket_factory_(socket_factory), - default_relay_port_factory_(new TurnPortFactory()), - relay_port_factory_(default_relay_port_factory_.get()) { - RTC_CHECK(socket_factory_); - RTC_DCHECK(relay_port_factory_); - RTC_DCHECK(network_manager_); - SetConfiguration(stun_servers, std::vector(), 0, - webrtc::NO_PRUNE, nullptr); -} - BasicPortAllocator::~BasicPortAllocator() { CheckRunOnValidThreadIfInitialized(); // Our created port allocator sessions depend on us, so destroy our remaining diff --git a/p2p/client/basic_port_allocator.h b/p2p/client/basic_port_allocator.h index 3c275c97e4..197d4b1e18 100644 --- a/p2p/client/basic_port_allocator.h +++ b/p2p/client/basic_port_allocator.h @@ -42,10 +42,10 @@ class RTC_EXPORT BasicPortAllocator : public PortAllocator { webrtc::TurnCustomizer* customizer = nullptr, RelayPortFactoryInterface* relay_port_factory = nullptr, const webrtc::FieldTrialsView* field_trials = nullptr); - BasicPortAllocator(rtc::NetworkManager* network_manager, - rtc::PacketSocketFactory* socket_factory, - const ServerAddresses& stun_servers, - const webrtc::FieldTrialsView* field_trials = nullptr); + + BasicPortAllocator(const BasicPortAllocator&) = delete; + BasicPortAllocator& operator=(const BasicPortAllocator&) = delete; + ~BasicPortAllocator() override; // Set to kDefaultNetworkIgnoreMask by default. diff --git a/p2p/client/basic_port_allocator_unittest.cc b/p2p/client/basic_port_allocator_unittest.cc index 102612274c..80ac2412d6 100644 --- a/p2p/client/basic_port_allocator_unittest.cc +++ b/p2p/client/basic_port_allocator_unittest.cc @@ -165,11 +165,11 @@ class BasicPortAllocatorTestBase : public ::testing::Test, kTurnUdpIntAddr, kTurnUdpExtAddr), candidate_allocation_done_(false) { - ServerAddresses stun_servers; - stun_servers.insert(kStunAddr); - allocator_ = std::make_unique( - &network_manager_, &socket_factory_, stun_servers, &field_trials_); + &network_manager_, &socket_factory_, /*customizer=*/nullptr, + /*relay_port_factory=*/nullptr, &field_trials_); + allocator_->SetConfiguration({kStunAddr}, {}, 0, webrtc::NO_PRUNE, nullptr); + allocator_->Initialize(); allocator_->set_step_delay(kMinimumStepDelay); webrtc::metrics::Reset(); @@ -489,9 +489,13 @@ class BasicPortAllocatorTestBase : public ::testing::Test, if (!stun_server.IsNil()) { stun_servers.insert(stun_server); } - allocator_.reset(new BasicPortAllocator(&network_manager_, - nat_socket_factory_.get(), - stun_servers, &field_trials_)); + allocator_ = std::make_unique( + &network_manager_, nat_socket_factory_.get(), + /*customizer=*/nullptr, + /*relay_port_factory=*/nullptr, &field_trials_); + allocator_->SetConfiguration(stun_servers, {}, 0, webrtc::NO_PRUNE, + nullptr); + allocator_->Initialize(); allocator_->set_step_delay(kMinimumStepDelay); }