tor-browser

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

commit 31383de1f0f64c51dc937a22cf0fba56055ce67a
parent 1970bf8c018d946c36da9d1895cba813909232a0
Author: Dan Baker <dbaker@mozilla.com>
Date:   Mon, 27 Oct 2025 14:15:53 -0600

Bug 1995393 - Vendor libwebrtc from 0650d67275

Upstream commit: https://webrtc.googlesource.com/src/+/0650d67275fb1fce507845e51149963ab4601954
    Extract SignalTrampoline to a separate .h file

    This is in anticpation of using it for other signals.

    Bug: webrtc:42222066
    Change-Id: Ibd8a308af896d47e876ffe8005699d424966b87e
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/406601
    Reviewed-by: Evan Shrubsole <eshr@webrtc.org>
    Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
    Commit-Queue: Harald Alvestrand <hta@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#45456}

Diffstat:
Mthird_party/libwebrtc/README.mozilla.last-vendor | 4++--
Mthird_party/libwebrtc/moz-patch-stack/s0001.patch | 2+-
Mthird_party/libwebrtc/moz-patch-stack/s0027.patch | 35++++++++++++++++++++---------------
Mthird_party/libwebrtc/moz-patch-stack/s0053.patch | 2+-
Mthird_party/libwebrtc/moz-patch-stack/s0091.patch | 2+-
Mthird_party/libwebrtc/moz-patch-stack/s0094.patch | 6+++---
Mthird_party/libwebrtc/moz-patch-stack/s0102.patch | 4++--
Mthird_party/libwebrtc/moz-patch-stack/s0107.patch | 8++++----
Mthird_party/libwebrtc/rtc_base/BUILD.gn | 11+++++++++++
Mthird_party/libwebrtc/rtc_base/network.h | 21++++-----------------
Athird_party/libwebrtc/rtc_base/sigslot_trampoline.h | 72++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mthird_party/libwebrtc/rtc_base/virtual_socket_server.cc | 3++-
Mthird_party/libwebrtc/rtc_base/virtual_socket_server.h | 9+++++++++
13 files changed, 132 insertions(+), 47 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-10-27T20:13:41.696729+00:00. +libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-27T20:15:41.288589+00:00. # base of lastest vendoring -bb00360f36 +0650d67275 diff --git a/third_party/libwebrtc/moz-patch-stack/s0001.patch b/third_party/libwebrtc/moz-patch-stack/s0001.patch @@ -1383,7 +1383,7 @@ index 5ccc3d7d38..cd957416bc 100644 const bool enable_svc_for_simulcast_; std::optional<SimulcastToSvcConverter> simulcast_to_svc_converter_; diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn -index 6293f7cc2a..1e88de16e7 100644 +index 14e7e51e68..429afac7cc 100644 --- a/rtc_base/BUILD.gn +++ b/rtc_base/BUILD.gn @@ -449,6 +449,12 @@ rtc_library("logging") { diff --git a/third_party/libwebrtc/moz-patch-stack/s0027.patch b/third_party/libwebrtc/moz-patch-stack/s0027.patch @@ -1013,7 +1013,7 @@ index 39aa39a41c..b26e30e8bb 100644 "/config/external/nspr", "/nsprpub/lib/ds", diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn -index 1e88de16e7..2d87e879e3 100644 +index 429afac7cc..7da246c703 100644 --- a/rtc_base/BUILD.gn +++ b/rtc_base/BUILD.gn @@ -326,6 +326,7 @@ rtc_library("sample_counter") { @@ -1050,12 +1050,17 @@ index 1e88de16e7..2d87e879e3 100644 visibility = [ "*" ] sources = [ "network.cc", -@@ -1222,16 +1227,20 @@ rtc_library("network") { +@@ -1223,6 +1228,7 @@ rtc_library("network") { deps += [ ":win32" ] } } +} + rtc_source_set("sigslot_trampoline") { + sources = [ "sigslot_trampoline.h" ] +@@ -1234,14 +1240,17 @@ rtc_source_set("sigslot_trampoline") { + } + rtc_library("socket_address_pair") { +if (!build_with_mozilla) { sources = [ @@ -1071,7 +1076,7 @@ index 1e88de16e7..2d87e879e3 100644 visibility = [ "*" ] sources = [ "net_helper.cc", -@@ -1242,8 +1251,10 @@ rtc_library("net_helper") { +@@ -1252,8 +1261,10 @@ rtc_library("net_helper") { "//third_party/abseil-cpp/absl/strings:string_view", ] } @@ -1082,7 +1087,7 @@ index 1e88de16e7..2d87e879e3 100644 visibility = [ "*" ] sources = [ "socket_adapters.cc", -@@ -1264,6 +1275,7 @@ rtc_library("socket_adapters") { +@@ -1274,6 +1285,7 @@ rtc_library("socket_adapters") { "//third_party/abseil-cpp/absl/strings:string_view", ] } @@ -1090,7 +1095,7 @@ index 1e88de16e7..2d87e879e3 100644 rtc_library("network_route") { sources = [ -@@ -1278,6 +1290,7 @@ rtc_library("network_route") { +@@ -1288,6 +1300,7 @@ rtc_library("network_route") { } rtc_library("async_tcp_socket") { @@ -1098,7 +1103,7 @@ index 1e88de16e7..2d87e879e3 100644 sources = [ "async_tcp_socket.cc", "async_tcp_socket.h", -@@ -1297,8 +1310,10 @@ rtc_library("async_tcp_socket") { +@@ -1307,8 +1320,10 @@ rtc_library("async_tcp_socket") { "network:sent_packet", ] } @@ -1109,7 +1114,7 @@ index 1e88de16e7..2d87e879e3 100644 visibility = [ "*" ] sources = [ "async_udp_socket.cc", -@@ -1322,8 +1337,10 @@ rtc_library("async_udp_socket") { +@@ -1332,8 +1347,10 @@ rtc_library("async_udp_socket") { "system:no_unique_address", ] } @@ -1120,7 +1125,7 @@ index 1e88de16e7..2d87e879e3 100644 visibility = [ "*" ] sources = [ "async_packet_socket.cc", -@@ -1346,6 +1363,7 @@ rtc_library("async_packet_socket") { +@@ -1356,6 +1373,7 @@ rtc_library("async_packet_socket") { "//third_party/abseil-cpp/absl/functional:any_invocable", ] } @@ -1128,7 +1133,7 @@ index 1e88de16e7..2d87e879e3 100644 if (rtc_include_tests) { rtc_library("async_packet_socket_unittest") { -@@ -1431,6 +1449,7 @@ rtc_library("data_rate_limiter") { +@@ -1441,6 +1459,7 @@ rtc_library("data_rate_limiter") { } rtc_library("unique_id_generator") { @@ -1136,7 +1141,7 @@ index 1e88de16e7..2d87e879e3 100644 sources = [ "unique_id_generator.cc", "unique_id_generator.h", -@@ -1448,6 +1467,7 @@ rtc_library("unique_id_generator") { +@@ -1458,6 +1477,7 @@ rtc_library("unique_id_generator") { "//third_party/abseil-cpp/absl/strings:string_view", ] } @@ -1144,7 +1149,7 @@ index 1e88de16e7..2d87e879e3 100644 rtc_library("crc32") { sources = [ -@@ -1479,6 +1499,7 @@ rtc_library("stream") { +@@ -1489,6 +1509,7 @@ rtc_library("stream") { } rtc_library("rtc_certificate_generator") { @@ -1152,7 +1157,7 @@ index 1e88de16e7..2d87e879e3 100644 visibility = [ "*" ] sources = [ "rtc_certificate_generator.cc", -@@ -1493,6 +1514,7 @@ rtc_library("rtc_certificate_generator") { +@@ -1503,6 +1524,7 @@ rtc_library("rtc_certificate_generator") { "//third_party/abseil-cpp/absl/functional:any_invocable", ] } @@ -1160,7 +1165,7 @@ index 1e88de16e7..2d87e879e3 100644 rtc_source_set("ssl_header") { visibility = [ "*" ] -@@ -1549,6 +1571,7 @@ rtc_library("crypto_random") { +@@ -1559,6 +1581,7 @@ rtc_library("crypto_random") { } rtc_library("ssl") { @@ -1168,7 +1173,7 @@ index 1e88de16e7..2d87e879e3 100644 visibility = [ "*" ] sources = [ "openssl_key_pair.cc", -@@ -1621,6 +1644,7 @@ rtc_library("ssl") { +@@ -1631,6 +1654,7 @@ rtc_library("ssl") { deps += [ ":win32" ] } } @@ -1176,7 +1181,7 @@ index 1e88de16e7..2d87e879e3 100644 rtc_library("ssl_adapter") { visibility = [ "*" ] -@@ -2344,7 +2368,7 @@ if (rtc_include_tests) { +@@ -2355,7 +2379,7 @@ if (rtc_include_tests) { } } diff --git a/third_party/libwebrtc/moz-patch-stack/s0053.patch b/third_party/libwebrtc/moz-patch-stack/s0053.patch @@ -29,7 +29,7 @@ index 7db75d5fd3..d0feb5007c 100644 rtc_library("task_queue_test") { visibility = [ "*" ] diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn -index 2d87e879e3..54a023fecb 100644 +index 7da246c703..694a99017c 100644 --- a/rtc_base/BUILD.gn +++ b/rtc_base/BUILD.gn @@ -664,10 +664,14 @@ if (is_mac || is_ios) { diff --git a/third_party/libwebrtc/moz-patch-stack/s0091.patch b/third_party/libwebrtc/moz-patch-stack/s0091.patch @@ -13,7 +13,7 @@ Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/4e7b3c485e549e7e3 1 file changed, 6 insertions(+) diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn -index 54a023fecb..e3dbf32b11 100644 +index 694a99017c..2e662a5d41 100644 --- a/rtc_base/BUILD.gn +++ b/rtc_base/BUILD.gn @@ -992,6 +992,12 @@ rtc_library("threading") { diff --git a/third_party/libwebrtc/moz-patch-stack/s0094.patch b/third_party/libwebrtc/moz-patch-stack/s0094.patch @@ -9,10 +9,10 @@ Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/ee2f06666bcc6d22c 1 file changed, 2 insertions(+) diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn -index e3dbf32b11..5631595e2c 100644 +index 2e662a5d41..fea1177742 100644 --- a/rtc_base/BUILD.gn +++ b/rtc_base/BUILD.gn -@@ -1657,6 +1657,7 @@ if (!build_with_mozilla) { +@@ -1667,6 +1667,7 @@ if (!build_with_mozilla) { } rtc_library("ssl_adapter") { @@ -20,7 +20,7 @@ index e3dbf32b11..5631595e2c 100644 visibility = [ "*" ] sources = [ "openssl_adapter.cc", -@@ -1705,6 +1706,7 @@ rtc_library("ssl_adapter") { +@@ -1715,6 +1716,7 @@ rtc_library("ssl_adapter") { configs += [ "..:external_ssl_library" ] } } diff --git a/third_party/libwebrtc/moz-patch-stack/s0102.patch b/third_party/libwebrtc/moz-patch-stack/s0102.patch @@ -616,7 +616,7 @@ index 7ed0ded7e6..d9750bebeb 100644 if (rtc_build_libsrtp) { diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn -index 5631595e2c..a21820e9e7 100644 +index fea1177742..15e24ce17e 100644 --- a/rtc_base/BUILD.gn +++ b/rtc_base/BUILD.gn @@ -9,8 +9,8 @@ @@ -630,7 +630,7 @@ index 5631595e2c..a21820e9e7 100644 } rtc_source_set("protobuf_utils") { -@@ -1897,8 +1897,8 @@ if (!rtc_rusty_base64) { +@@ -1908,8 +1908,8 @@ if (!rtc_rusty_base64) { ] } } else { diff --git a/third_party/libwebrtc/moz-patch-stack/s0107.patch b/third_party/libwebrtc/moz-patch-stack/s0107.patch @@ -116,10 +116,10 @@ index ecbb7eae7e..a13fe19324 100644 public_configs = [] if (!build_with_chromium) { diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn -index a21820e9e7..8208b5d0e1 100644 +index 15e24ce17e..8545ddf16f 100644 --- a/rtc_base/BUILD.gn +++ b/rtc_base/BUILD.gn -@@ -1536,6 +1536,7 @@ rtc_source_set("ssl_header") { +@@ -1546,6 +1546,7 @@ rtc_source_set("ssl_header") { } rtc_library("digest") { @@ -127,7 +127,7 @@ index a21820e9e7..8208b5d0e1 100644 visibility = [ "*" ] sources = [ "message_digest.cc", -@@ -1557,8 +1558,10 @@ rtc_library("digest") { +@@ -1567,8 +1568,10 @@ rtc_library("digest") { configs += [ "..:external_ssl_library" ] } } @@ -138,7 +138,7 @@ index a21820e9e7..8208b5d0e1 100644 visibility = [ "*" ] sources = [ "crypto_random.cc", -@@ -1579,6 +1582,7 @@ rtc_library("crypto_random") { +@@ -1589,6 +1592,7 @@ rtc_library("crypto_random") { configs += [ "..:external_ssl_library" ] } } diff --git a/third_party/libwebrtc/rtc_base/BUILD.gn b/third_party/libwebrtc/rtc_base/BUILD.gn @@ -1209,6 +1209,7 @@ if (!build_with_mozilla) { ":mdns_responder_interface", ":net_helpers", ":network_constants", + ":sigslot_trampoline", ":socket", ":socket_address", ":socket_factory", @@ -1239,6 +1240,15 @@ if (!build_with_mozilla) { } } +rtc_source_set("sigslot_trampoline") { + sources = [ "sigslot_trampoline.h" ] + deps = [ + ":callback_list", + "third_party/sigslot", + "//third_party/abseil-cpp/absl/functional:any_invocable", + ] +} + rtc_library("socket_address_pair") { if (!build_with_mozilla) { sources = [ @@ -1813,6 +1823,7 @@ rtc_library("rtc_base_tests_utils") { ":network", ":network_constants", ":rtc_event", + ":sigslot_trampoline", ":socket", ":socket_adapters", ":socket_address", diff --git a/third_party/libwebrtc/rtc_base/network.h b/third_party/libwebrtc/rtc_base/network.h @@ -28,13 +28,13 @@ #include "api/scoped_refptr.h" #include "api/sequence_checker.h" #include "api/task_queue/pending_task_safety_flag.h" -#include "rtc_base/callback_list.h" #include "rtc_base/checks.h" #include "rtc_base/ip_address.h" #include "rtc_base/mdns_responder_interface.h" #include "rtc_base/network_constants.h" #include "rtc_base/network_monitor.h" #include "rtc_base/network_monitor_factory.h" +#include "rtc_base/sigslot_trampoline.h" #include "rtc_base/socket_factory.h" #include "rtc_base/system/rtc_export.h" #include "rtc_base/third_party/sigslot/sigslot.h" @@ -202,23 +202,10 @@ class RTC_EXPORT NetworkManager : public DefaultLocalAddressProvider, void NotifyError() { SignalError(); } private: - template <auto member_signal> - class SignalTrampoline : public sigslot::has_slots<> { - public: - explicit SignalTrampoline(NetworkManager* that) { - (that->*member_signal).connect(this, &SignalTrampoline::Notify); - } - void Notify() { callbacks_.Send(); } - void Subscribe(absl::AnyInvocable<void()> callback) { - callbacks_.AddReceiver(std::move(callback)); - } - - private: - CallbackList<> callbacks_; - }; - SignalTrampoline<&NetworkManager::SignalNetworksChanged> + SignalTrampoline<NetworkManager, &NetworkManager::SignalNetworksChanged> networks_changed_trampoline_; - SignalTrampoline<&NetworkManager::SignalError> error_trampoline_; + SignalTrampoline<NetworkManager, &NetworkManager::SignalError> + error_trampoline_; }; // Represents a Unix-type network interface, with a name and single address. diff --git a/third_party/libwebrtc/rtc_base/sigslot_trampoline.h b/third_party/libwebrtc/rtc_base/sigslot_trampoline.h @@ -0,0 +1,72 @@ +/* + * Copyright 2025 The WebRTC Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef RTC_BASE_SIGSLOT_TRAMPOLINE_H_ +#define RTC_BASE_SIGSLOT_TRAMPOLINE_H_ + +#include <utility> + +#include "absl/functional/any_invocable.h" +#include "rtc_base/callback_list.h" +#include "rtc_base/third_party/sigslot/sigslot.h" + +namespace webrtc { +// A template to simplify the replacement of sigslot::Signal with a +// CallbackList. + +// THIS IS A TEMPORARY OBJECT: +// Once all callers have converted to Subscribe* and Notify*, the signal +// and the trampoline can be replaced with a CallbackList, or, for the case +// where only one listener can ever exist, a simple callback. + +// Usage, for class MyClass and signal SignalMyNamedEvent: +// class MyClass { +// MyClass() +// : my_named_event_trampoline_(this) {} +// // existing: +// sigslot::signal0<> SignalMyNamedEvent; +// // new, this is what we want callers to use instead +// void NotifyMyNamedEvent() { SignalMyNamedEvent(); } +// void SubscribeMyNamedEvent(absl::AnyInvocable<void()> callback) { +// my_named_event_trampoline_.Subscribe(std::move(callback)); +// } +// private: +// SignalTrampoline<MyClass, &MyClass::SignalMyNamedEvent> +// my_named_event_trampoline_; +// } +// +// At caller, replace: +// my_class_object.SignalMyNamedEvent.connect(target, function) +// with: +// my_class_object.SubscribeMyNamedEvent([target]{ target.function(); } +// Note that the SubscribeMyNamedEvent will NOT guarantee that the target +// continues to exist; if there is any doubt about that, use a SafeInvocable: +// my_class_object.SubscibeMyNamedEvent( +// SafeInvocable(target.safety_flag_.flag(), +// [target] { target.function(); } + +template <class T, sigslot::signal0<> T::* member_signal> +class SignalTrampoline : public sigslot::has_slots<> { + public: + explicit SignalTrampoline(T* that) { + (that->*member_signal).connect(this, &SignalTrampoline::Notify); + } + void Subscribe(absl::AnyInvocable<void()> callback) { + callbacks_.AddReceiver(std::move(callback)); + } + + private: + void Notify() { callbacks_.Send(); } + CallbackList<> callbacks_; +}; + +} // namespace webrtc + +#endif // RTC_BASE_SIGSLOT_TRAMPOLINE_H_ diff --git a/third_party/libwebrtc/rtc_base/virtual_socket_server.cc b/third_party/libwebrtc/rtc_base/virtual_socket_server.cc @@ -677,7 +677,8 @@ VirtualSocketServer::VirtualSocketServer(ThreadProcessingFakeClock* fake_clock) delay_mean_(0), delay_stddev_(0), delay_samples_(NUM_SAMPLES), - drop_prob_(0.0) { + drop_prob_(0.0), + ready_to_send_trampoline_(this) { UpdateDelayDistribution(); } diff --git a/third_party/libwebrtc/rtc_base/virtual_socket_server.h b/third_party/libwebrtc/rtc_base/virtual_socket_server.h @@ -28,6 +28,7 @@ #include "rtc_base/event.h" #include "rtc_base/fake_clock.h" #include "rtc_base/ip_address.h" +#include "rtc_base/sigslot_trampoline.h" #include "rtc_base/socket.h" #include "rtc_base/socket_address.h" #include "rtc_base/socket_address_pair.h" @@ -380,7 +381,13 @@ class VirtualSocketServer : public SocketServer { uint32_t SendDelay(uint32_t size) RTC_LOCKS_EXCLUDED(mutex_); // Sending was previously blocked, but now isn't. + // Deprecated interface sigslot::signal0<> SignalReadyToSend; + // New interface + void NotifyReadyToSend() { SignalReadyToSend(); } + void SubscribeReadyToSend(absl::AnyInvocable<void()> callback) { + ready_to_send_trampoline_.Subscribe(std::move(callback)); + } protected: // Returns a new IP not used before in this network. @@ -485,6 +492,8 @@ class VirtualSocketServer : public SocketServer { size_t max_udp_payload_ RTC_GUARDED_BY(mutex_) = 65507; bool sending_blocked_ RTC_GUARDED_BY(mutex_) = false; + SignalTrampoline<VirtualSocketServer, &VirtualSocketServer::SignalReadyToSend> + ready_to_send_trampoline_; }; } // namespace webrtc