tor-browser

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

commit 4a20f37c095d7fe4829e3dc26a0c69b375be0557
parent 88fc9548c6105eb714369b2c8a74e8461da072c7
Author: Dan Baker <dbaker@mozilla.com>
Date:   Mon,  1 Dec 2025 21:57:26 -0700

Bug 2000941 - Vendor libwebrtc from 8acfa03034

Upstream commit: https://webrtc.googlesource.com/src/+/8acfa030348178d45a6ef114ab284341c6340f3a
    Use propagate clock in AsyncPacketSocket implementations

    Bug: webrtc:42223992
    Change-Id: Ie6505e3241b442146a3191f95cd2c6e604316ee8
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/410042
    Commit-Queue: Harald Alvestrand <hta@webrtc.org>
    Reviewed-by: Harald Alvestrand <hta@webrtc.org>
    Auto-Submit: Danil Chapovalov <danilchap@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#45680}

Diffstat:
Mthird_party/libwebrtc/README.mozilla.last-vendor | 4++--
Mthird_party/libwebrtc/p2p/base/async_stun_tcp_socket.cc | 11+++++------
Mthird_party/libwebrtc/p2p/base/async_stun_tcp_socket.h | 2++
Mthird_party/libwebrtc/rtc_base/async_tcp_socket.cc | 11+++++------
Mthird_party/libwebrtc/rtc_base/async_tcp_socket.h | 3+++
Mthird_party/libwebrtc/rtc_base/async_udp_socket.cc | 17+++++++++--------
Mthird_party/libwebrtc/rtc_base/async_udp_socket.h | 1+
7 files changed, 27 insertions(+), 22 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-02T04:54:51.345200+00:00. +libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-12-02T04:57:12.519179+00:00. # base of lastest vendoring -b555e8d6b3 +8acfa03034 diff --git a/third_party/libwebrtc/p2p/base/async_stun_tcp_socket.cc b/third_party/libwebrtc/p2p/base/async_stun_tcp_socket.cc @@ -20,7 +20,6 @@ #include "api/array_view.h" #include "api/environment/environment.h" #include "api/transport/stun.h" -#include "api/units/timestamp.h" #include "rtc_base/async_packet_socket.h" #include "rtc_base/async_tcp_socket.h" #include "rtc_base/byte_order.h" @@ -29,7 +28,6 @@ #include "rtc_base/network/sent_packet.h" #include "rtc_base/socket.h" #include "rtc_base/socket_address.h" -#include "rtc_base/time_utils.h" namespace webrtc { @@ -47,9 +45,9 @@ inline bool IsStunMessage(uint16_t msg_type) { } AsyncStunTCPSocket::AsyncStunTCPSocket( - const Environment& /*env*/, + const Environment& env, absl_nonnull std::unique_ptr<Socket> socket) - : AsyncTCPSocketBase(std::move(socket), kBufSize) {} + : AsyncTCPSocketBase(std::move(socket), kBufSize), env_(env) {} int AsyncStunTCPSocket::Send(const void* pv, size_t cb, @@ -83,7 +81,8 @@ int AsyncStunTCPSocket::Send(const void* pv, return res; } - SentPacketInfo sent_packet(options.packet_id, TimeMillis()); + SentPacketInfo sent_packet(options.packet_id, + env_.clock().TimeInMilliseconds()); SignalSentPacket(this, sent_packet); // We claim to have sent the whole thing, even if we only sent partial @@ -120,7 +119,7 @@ size_t AsyncStunTCPSocket::ProcessInput(ArrayView<const uint8_t> data) { ReceivedIpPacket received_packet( data.subview(processed_bytes, expected_pkt_len), remote_addr, - Timestamp::Micros(TimeMicros())); + env_.clock().CurrentTime()); NotifyPacketReceived(received_packet); processed_bytes += actual_length; } diff --git a/third_party/libwebrtc/p2p/base/async_stun_tcp_socket.h b/third_party/libwebrtc/p2p/base/async_stun_tcp_socket.h @@ -42,6 +42,8 @@ class AsyncStunTCPSocket : public AsyncTCPSocketBase { // This method also returns the number of padding bytes needed/added to the // turn message. `pad_bytes` should be used only when `is_turn` is true. size_t GetExpectedLength(const void* data, size_t len, int* pad_bytes); + + const Environment env_; }; } // namespace webrtc diff --git a/third_party/libwebrtc/rtc_base/async_tcp_socket.cc b/third_party/libwebrtc/rtc_base/async_tcp_socket.cc @@ -21,7 +21,6 @@ #include "absl/memory/memory.h" #include "api/array_view.h" #include "api/environment/environment.h" -#include "api/units/timestamp.h" #include "rtc_base/async_packet_socket.h" #include "rtc_base/byte_order.h" #include "rtc_base/checks.h" @@ -30,7 +29,6 @@ #include "rtc_base/network/sent_packet.h" #include "rtc_base/socket.h" #include "rtc_base/socket_address.h" -#include "rtc_base/time_utils.h" #if defined(WEBRTC_POSIX) #include <cerrno> @@ -233,9 +231,9 @@ void AsyncTCPSocketBase::OnCloseEvent(Socket* socket, int error) { NotifyClosed(error); } -AsyncTCPSocket::AsyncTCPSocket(const Environment& /*env*/, +AsyncTCPSocket::AsyncTCPSocket(const Environment& env, absl_nonnull std::unique_ptr<Socket> socket) - : AsyncTCPSocketBase(std::move(socket), kBufSize) {} + : AsyncTCPSocketBase(std::move(socket), kBufSize), env_(env) {} int AsyncTCPSocket::Send(const void* pv, size_t cb, @@ -260,7 +258,8 @@ int AsyncTCPSocket::Send(const void* pv, return res; } - SentPacketInfo sent_packet(options.packet_id, TimeMillis(), + SentPacketInfo sent_packet(options.packet_id, + env_.clock().TimeInMilliseconds(), options.info_signaled_after_sent); CopySocketInformationToPacketInfo(cb, *this, &sent_packet.info); SignalSentPacket(this, sent_packet); @@ -284,7 +283,7 @@ size_t AsyncTCPSocket::ProcessInput(ArrayView<const uint8_t> data) { ReceivedIpPacket received_packet( data.subview(processed_bytes + kPacketLenSize, pkt_len), remote_addr, - Timestamp::Micros(TimeMicros())); + env_.clock().CurrentTime()); NotifyPacketReceived(received_packet); processed_bytes += kPacketLenSize + pkt_len; } diff --git a/third_party/libwebrtc/rtc_base/async_tcp_socket.h b/third_party/libwebrtc/rtc_base/async_tcp_socket.h @@ -94,6 +94,9 @@ class AsyncTCPSocket : public AsyncTCPSocketBase { size_t cb, const AsyncSocketPacketOptions& options) override; size_t ProcessInput(ArrayView<const uint8_t>) override; + + private: + const Environment env_; }; class AsyncTcpListenSocket : public AsyncListenSocket { diff --git a/third_party/libwebrtc/rtc_base/async_udp_socket.cc b/third_party/libwebrtc/rtc_base/async_udp_socket.cc @@ -19,7 +19,6 @@ #include "api/environment/environment.h" #include "api/sequence_checker.h" #include "api/units/time_delta.h" -#include "api/units/timestamp.h" #include "rtc_base/async_packet_socket.h" #include "rtc_base/checks.h" #include "rtc_base/logging.h" @@ -28,7 +27,6 @@ #include "rtc_base/socket.h" #include "rtc_base/socket_address.h" #include "rtc_base/socket_factory.h" -#include "rtc_base/time_utils.h" namespace webrtc { @@ -48,9 +46,10 @@ absl_nullable std::unique_ptr<AsyncUDPSocket> AsyncUDPSocket::Create( return std::make_unique<AsyncUDPSocket>(env, std::move(socket)); } -AsyncUDPSocket::AsyncUDPSocket(const Environment& /*env*/, +AsyncUDPSocket::AsyncUDPSocket(const Environment& env, absl_nonnull std::unique_ptr<Socket> socket) - : sequence_checker_(SequenceChecker::kDetached), + : env_(env), + sequence_checker_(SequenceChecker::kDetached), socket_(std::move(socket)) { // The socket should start out readable but not writable. socket_->SignalReadEvent.connect(this, &AsyncUDPSocket::OnReadEvent); @@ -68,7 +67,8 @@ SocketAddress AsyncUDPSocket::GetRemoteAddress() const { int AsyncUDPSocket::Send(const void* pv, size_t cb, const AsyncSocketPacketOptions& options) { - SentPacketInfo sent_packet(options.packet_id, TimeMillis(), + SentPacketInfo sent_packet(options.packet_id, + env_.clock().TimeInMilliseconds(), options.info_signaled_after_sent); CopySocketInformationToPacketInfo(cb, *this, &sent_packet.info); int ret = socket_->Send(pv, cb); @@ -80,7 +80,8 @@ int AsyncUDPSocket::SendTo(const void* pv, size_t cb, const SocketAddress& addr, const AsyncSocketPacketOptions& options) { - SentPacketInfo sent_packet(options.packet_id, TimeMillis(), + SentPacketInfo sent_packet(options.packet_id, + env_.clock().TimeInMilliseconds(), options.info_signaled_after_sent); CopySocketInformationToPacketInfo(cb, *this, &sent_packet.info); if (has_set_ect1_options_ != options.ecn_1) { @@ -144,12 +145,12 @@ void AsyncUDPSocket::OnReadEvent(Socket* socket) { if (!receive_buffer.arrival_time) { // Timestamp from socket is not available. - receive_buffer.arrival_time = Timestamp::Micros(TimeMicros()); + receive_buffer.arrival_time = env_.clock().CurrentTime(); } else { if (!socket_time_offset_) { // Estimate timestamp offset from first packet arrival time. socket_time_offset_ = - Timestamp::Micros(TimeMicros()) - *receive_buffer.arrival_time; + env_.clock().CurrentTime() - *receive_buffer.arrival_time; } *receive_buffer.arrival_time += *socket_time_offset_; } diff --git a/third_party/libwebrtc/rtc_base/async_udp_socket.h b/third_party/libwebrtc/rtc_base/async_udp_socket.h @@ -68,6 +68,7 @@ class AsyncUDPSocket : public AsyncPacketSocket { // Called when the underlying socket is ready to send. void OnWriteEvent(Socket* socket); + const Environment env_; RTC_NO_UNIQUE_ADDRESS SequenceChecker sequence_checker_; std::unique_ptr<Socket> socket_; bool has_set_ect1_options_ = false;