tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 1189a78a4a215fac054efd4d13a9a53ed6b1c920
parent 1862abc0a5050a6fabd8a0b17745603c90876e9e
Author: Dan Baker <dbaker@mozilla.com>
Date:   Mon,  1 Dec 2025 17:35:03 -0700

Bug 2000941 - Vendor libwebrtc from d7b5845e5e

Upstream commit: https://webrtc.googlesource.com/src/+/d7b5845e5ee278eb79dbff290ac54cc6cef96853
    use sigslot trampoline for Port ready signal

    Bug: webrtc:42222066
    Change-Id: I55ba46ecffbb39e18e801c87e0a644be42d4cade
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/407800
    Reviewed-by: Harald Alvestrand <hta@webrtc.org>
    Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
    Commit-Queue: Lena Kaplan <lenakaplan@meta.com>
    Cr-Commit-Position: refs/heads/main@{#45586}

Diffstat:
Mthird_party/libwebrtc/README.mozilla.last-vendor | 4++--
Mthird_party/libwebrtc/p2p/BUILD.gn | 1+
Mthird_party/libwebrtc/p2p/base/p2p_transport_channel.cc | 39+++++++++++++++++++++++++++++----------
Mthird_party/libwebrtc/p2p/base/p2p_transport_channel_unittest.cc | 14++++++++++----
Mthird_party/libwebrtc/p2p/base/port_allocator.cc | 9++++++++-
Mthird_party/libwebrtc/p2p/base/port_allocator.h | 57+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mthird_party/libwebrtc/p2p/base/regathering_controller_unittest.cc | 7+++++--
Mthird_party/libwebrtc/p2p/client/basic_port_allocator_unittest.cc | 33+++++++++++++++++++++++----------
8 files changed, 135 insertions(+), 29 deletions(-)

diff --git a/third_party/libwebrtc/README.mozilla.last-vendor b/third_party/libwebrtc/README.mozilla.last-vendor @@ -1,4 +1,4 @@ # ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc -libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-12-02T00:32:13.161451+00:00. +libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-12-02T00:34:47.337550+00:00. # base of lastest vendoring -9cd5923be4 +d7b5845e5e diff --git a/third_party/libwebrtc/p2p/BUILD.gn b/third_party/libwebrtc/p2p/BUILD.gn @@ -634,6 +634,7 @@ rtc_library("port_allocator") { "../rtc_base:checks", "../rtc_base:crypto_random", "../rtc_base:network", + "../rtc_base:sigslot_trampoline", "../rtc_base:socket_address", "../rtc_base:ssl", "../rtc_base:threading", diff --git a/third_party/libwebrtc/p2p/base/p2p_transport_channel.cc b/third_party/libwebrtc/p2p/base/p2p_transport_channel.cc @@ -255,16 +255,35 @@ void P2PTransportChannel::AddAllocatorSession( RTC_DCHECK_RUN_ON(network_thread_); session->set_generation(static_cast<uint32_t>(allocator_sessions_.size())); - session->SignalPortReady.connect(this, &P2PTransportChannel::OnPortReady); - session->SignalPortsPruned.connect(this, &P2PTransportChannel::OnPortsPruned); - session->SignalCandidatesReady.connect( - this, &P2PTransportChannel::OnCandidatesReady); - session->SignalCandidateError.connect(this, - &P2PTransportChannel::OnCandidateError); - session->SignalCandidatesRemoved.connect( - this, &P2PTransportChannel::OnCandidatesRemoved); - session->SignalCandidatesAllocationDone.connect( - this, &P2PTransportChannel::OnCandidatesAllocationDone); + session->SubscribePortReady( + [this](PortAllocatorSession* session, PortInterface* port) { + OnPortReady(session, port); + }); + + session->SubscribePortsPruned( + [this](PortAllocatorSession* session, + const std::vector<PortInterface*>& ports) { + OnPortsPruned(session, ports); + }); + + session->SubscribeCandidatesReady( + [this](PortAllocatorSession* session, + const std::vector<Candidate>& candidate) { + OnCandidatesReady(session, candidate); + }); + session->SubscribeCandidateError([this](PortAllocatorSession* session, + const IceCandidateErrorEvent& event) { + OnCandidateError(session, event); + }); + session->SubscribeCandidatesRemoved( + [this](PortAllocatorSession* session, + const std::vector<Candidate>& candidates) { + OnCandidatesRemoved(session, candidates); + }); + session->SubscribeCandidatesAllocationDone( + [this](PortAllocatorSession* session) { + OnCandidatesAllocationDone(session); + }); if (!allocator_sessions_.empty()) { allocator_session()->PruneAllPorts(); } diff --git a/third_party/libwebrtc/p2p/base/p2p_transport_channel_unittest.cc b/third_party/libwebrtc/p2p/base/p2p_transport_channel_unittest.cc @@ -465,10 +465,16 @@ class P2PTransportChannelTestBase : public ::testing::Test, ep2_.cd1_.ch_->SetIceConfig(ep2_config); ep1_.cd1_.ch_->MaybeStartGathering(); ep2_.cd1_.ch_->MaybeStartGathering(); - ep1_.cd1_.ch_->allocator_session()->SignalIceRegathering.connect( - &ep1_, &Endpoint::OnIceRegathering); - ep2_.cd1_.ch_->allocator_session()->SignalIceRegathering.connect( - &ep2_, &Endpoint::OnIceRegathering); + ep1_.cd1_.ch_->allocator_session()->SubscribeIceRegathering( + [this](PortAllocatorSession* allocator_session, + IceRegatheringReason reason) { + ep1_.OnIceRegathering(allocator_session, reason); + }); + ep2_.cd1_.ch_->allocator_session()->SubscribeIceRegathering( + [this](PortAllocatorSession* allocator_session, + IceRegatheringReason reason) { + ep2_.OnIceRegathering(allocator_session, reason); + }); } void CreateChannels(const Environment& env) { diff --git a/third_party/libwebrtc/p2p/base/port_allocator.cc b/third_party/libwebrtc/p2p/base/port_allocator.cc @@ -77,7 +77,14 @@ PortAllocatorSession::PortAllocatorSession(absl::string_view content_name, content_name_(content_name), component_(component), ice_ufrag_(ice_ufrag), - ice_pwd_(ice_pwd) { + ice_pwd_(ice_pwd), + port_ready_trampoline_(this), + ports_pruned_trampoline_(this), + candidates_ready_trampoline_(this), + candidate_error_trampoline_(this), + candidates_removed_trampoline_(this), + candidates_allocation_done_trampoline_(this), + ice_regathering_trampoline_(this) { // Pooled sessions are allowed to be created with empty content name, // component, ufrag and password. RTC_DCHECK(ice_ufrag.empty() == ice_pwd.empty()); diff --git a/third_party/libwebrtc/p2p/base/port_allocator.h b/third_party/libwebrtc/p2p/base/port_allocator.h @@ -15,6 +15,7 @@ #include <memory> #include <optional> #include <string> +#include <utility> #include <vector> #include "absl/strings/string_view.h" @@ -262,24 +263,59 @@ class RTC_EXPORT PortAllocatorSession : public sigslot::has_slots<> { virtual void PruneAllPorts() {} sigslot::signal2<PortAllocatorSession*, PortInterface*> SignalPortReady; + void SubscribePortReady(absl::AnyInvocable<void(PortAllocatorSession*, + PortInterface*)> callback) { + port_ready_trampoline_.Subscribe(std::move(callback)); + } + // Fires this signal when the network of the ports failed (either because the // interface is down, or because there is no connection on the interface), // or when TURN ports are pruned because a higher-priority TURN port becomes // ready(pairable). sigslot::signal2<PortAllocatorSession*, const std::vector<PortInterface*>&> SignalPortsPruned; + void SubscribePortsPruned( + absl::AnyInvocable<void(PortAllocatorSession*, + const std::vector<PortInterface*>&)> callback) { + ports_pruned_trampoline_.Subscribe(std::move(callback)); + } + sigslot::signal2<PortAllocatorSession*, const std::vector<Candidate>&> SignalCandidatesReady; + void SubscribeCandidatesReady( + absl::AnyInvocable<void(PortAllocatorSession*, + const std::vector<Candidate>&)> callback) { + candidates_ready_trampoline_.Subscribe(std::move(callback)); + } sigslot::signal2<PortAllocatorSession*, const IceCandidateErrorEvent&> SignalCandidateError; + void SubscribeCandidateError( + absl::AnyInvocable<void(PortAllocatorSession*, + const IceCandidateErrorEvent&)> callback) { + candidate_error_trampoline_.Subscribe(std::move(callback)); + } // Candidates should be signaled to be removed when the port that generated // the candidates is removed. sigslot::signal2<PortAllocatorSession*, const std::vector<Candidate>&> SignalCandidatesRemoved; + void SubscribeCandidatesRemoved( + absl::AnyInvocable<void(PortAllocatorSession*, + const std::vector<Candidate>&)> callback) { + candidates_removed_trampoline_.Subscribe(std::move(callback)); + } sigslot::signal1<PortAllocatorSession*> SignalCandidatesAllocationDone; + void SubscribeCandidatesAllocationDone( + absl::AnyInvocable<void(PortAllocatorSession*)> callback) { + candidates_allocation_done_trampoline_.Subscribe(std::move(callback)); + } sigslot::signal2<PortAllocatorSession*, IceRegatheringReason> SignalIceRegathering; + void SubscribeIceRegathering( + absl::AnyInvocable<void(PortAllocatorSession*, IceRegatheringReason)> + callback) { + ice_regathering_trampoline_.Subscribe(std::move(callback)); + } virtual uint32_t generation(); virtual void set_generation(uint32_t generation); @@ -332,6 +368,27 @@ class RTC_EXPORT PortAllocatorSession : public sigslot::has_slots<> { // SetIceParameters is an implementation detail which only PortAllocator // should be able to call. friend class PortAllocator; + SignalTrampoline<PortAllocatorSession, &PortAllocatorSession::SignalPortReady> + port_ready_trampoline_; + SignalTrampoline<PortAllocatorSession, + &PortAllocatorSession::SignalPortsPruned> + ports_pruned_trampoline_; + SignalTrampoline<PortAllocatorSession, + &PortAllocatorSession::SignalCandidatesReady> + candidates_ready_trampoline_; + SignalTrampoline<PortAllocatorSession, + &PortAllocatorSession::SignalCandidateError> + candidate_error_trampoline_; + SignalTrampoline<PortAllocatorSession, + &PortAllocatorSession::SignalCandidatesRemoved> + candidates_removed_trampoline_; + SignalTrampoline<PortAllocatorSession, + &PortAllocatorSession::SignalCandidatesAllocationDone> + candidates_allocation_done_trampoline_; + + SignalTrampoline<PortAllocatorSession, + &PortAllocatorSession::SignalIceRegathering> + ice_regathering_trampoline_; }; // Every method of PortAllocator (including the destructor) must be called on diff --git a/third_party/libwebrtc/p2p/base/regathering_controller_unittest.cc b/third_party/libwebrtc/p2p/base/regathering_controller_unittest.cc @@ -82,8 +82,11 @@ class RegatheringControllerTest : public ::testing::Test, // call of StartGettingPorts is blocking. We will not ClearGettingPorts // prematurely. allocator_session_->StartGettingPorts(); - allocator_session_->SignalIceRegathering.connect( - this, &RegatheringControllerTest::OnIceRegathering); + allocator_session_->SubscribeIceRegathering( + [this](PortAllocatorSession* allocator_session, + IceRegatheringReason reason) { + OnIceRegathering(allocator_session, reason); + }); regathering_controller_->set_allocator_session(allocator_session_.get()); } diff --git a/third_party/libwebrtc/p2p/client/basic_port_allocator_unittest.cc b/third_party/libwebrtc/p2p/client/basic_port_allocator_unittest.cc @@ -288,16 +288,29 @@ class BasicPortAllocatorTestBase : public ::testing::Test, absl::string_view ice_pwd) { std::unique_ptr<PortAllocatorSession> session = allocator_->CreateSession(content_name, component, ice_ufrag, ice_pwd); - session->SignalPortReady.connect(this, - &BasicPortAllocatorTestBase::OnPortReady); - session->SignalPortsPruned.connect( - this, &BasicPortAllocatorTestBase::OnPortsPruned); - session->SignalCandidatesReady.connect( - this, &BasicPortAllocatorTestBase::OnCandidatesReady); - session->SignalCandidatesRemoved.connect( - this, &BasicPortAllocatorTestBase::OnCandidatesRemoved); - session->SignalCandidatesAllocationDone.connect( - this, &BasicPortAllocatorTestBase::OnCandidatesAllocationDone); + session->SubscribePortReady( + [this](PortAllocatorSession* session, PortInterface* port) { + OnPortReady(session, port); + }); + session->SubscribePortsPruned( + [this](PortAllocatorSession* session, + const std::vector<PortInterface*>& ports) { + OnPortsPruned(session, ports); + }); + session->SubscribeCandidatesReady( + [this](PortAllocatorSession* session, + const std::vector<Candidate>& candidate) { + OnCandidatesReady(session, candidate); + }); + session->SubscribeCandidatesRemoved( + [this](PortAllocatorSession* session, + const std::vector<Candidate>& removed_candidates) { + OnCandidatesRemoved(session, removed_candidates); + }); + session->SubscribeCandidatesAllocationDone( + [this](PortAllocatorSession* session) { + OnCandidatesAllocationDone(session); + }); return session; }