tor-browser

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

commit 8b8cc098e2ebff59de0a6a2020f85cd6c8ec5b70
parent c91426d3ad91d752f4fffb9d1e933d6a51a2d5be
Author: Dan Baker <dbaker@mozilla.com>
Date:   Tue,  2 Dec 2025 00:24:25 -0700

Bug 2000941 - Vendor libwebrtc from 4509dba6ea

Upstream commit: https://webrtc.googlesource.com/src/+/4509dba6eadf99fa47da66cb7fe64c0007175eda
    Add TakeImage and modernize MouseCursor

    This allows the caller to take ownership of the underlying cursor image
    and wrap it with SharedDesktopFrame so that it can be shared.

    Also modernize MouseCursor by introducing overloads that take
    std::unique_ptrs instead of raw pointers, and using `= default` in
    ctor/dtor.

    See this comment:

    https://source.chromium.org/chromium/chromium/src/+/main:remoting/host/linux/pipewire_mouse_cursor_capturer.cc;l=82;drc=3032b3fec036e5143d5e0b802697e69bcbcf1a86

    Bug: chromium:430118584
    Change-Id: If44daf01905eb63bcf6f5335a4fd2b06b8ace723
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/411540
    Auto-Submit: Yuwei Huang <yuweih@chromium.org>
    Commit-Queue: Mark Foltz <mfoltz@chromium.org>
    Reviewed-by: Mark Foltz <mfoltz@chromium.org>
    Reviewed-by: Alexander Cooper <alcooper@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#45733}

Diffstat:
Mthird_party/libwebrtc/README.mozilla.last-vendor | 4++--
Mthird_party/libwebrtc/modules/desktop_capture/mouse_cursor.cc | 16++++++++++++----
Mthird_party/libwebrtc/modules/desktop_capture/mouse_cursor.h | 17+++++++++++++++++
3 files changed, 31 insertions(+), 6 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-02T07:20:58.184732+00:00. +libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-12-02T07:24:11.019655+00:00. # base of lastest vendoring -524bfd80cf +4509dba6ea diff --git a/third_party/libwebrtc/modules/desktop_capture/mouse_cursor.cc b/third_party/libwebrtc/modules/desktop_capture/mouse_cursor.cc @@ -16,15 +16,19 @@ namespace webrtc { -MouseCursor::MouseCursor() {} +MouseCursor::MouseCursor() = default; -MouseCursor::MouseCursor(DesktopFrame* image, const DesktopVector& hotspot) - : image_(image), hotspot_(hotspot) { +MouseCursor::MouseCursor(std::unique_ptr<DesktopFrame> image, + const DesktopVector& hotspot) + : image_(std::move(image)), hotspot_(hotspot) { RTC_DCHECK(0 <= hotspot_.x() && hotspot_.x() <= image_->size().width()); RTC_DCHECK(0 <= hotspot_.y() && hotspot_.y() <= image_->size().height()); } -MouseCursor::~MouseCursor() {} +MouseCursor::MouseCursor(DesktopFrame* image, const DesktopVector& hotspot) + : MouseCursor(std::unique_ptr<DesktopFrame>(image), hotspot) {} + +MouseCursor::~MouseCursor() = default; // static MouseCursor* MouseCursor::CopyOf(const MouseCursor& cursor) { @@ -34,4 +38,8 @@ MouseCursor* MouseCursor::CopyOf(const MouseCursor& cursor) { : new MouseCursor(); } +std::unique_ptr<DesktopFrame> MouseCursor::TakeImage() { + return std::move(image_); +} + } // namespace webrtc diff --git a/third_party/libwebrtc/modules/desktop_capture/mouse_cursor.h b/third_party/libwebrtc/modules/desktop_capture/mouse_cursor.h @@ -23,6 +23,12 @@ class RTC_EXPORT MouseCursor { public: MouseCursor(); + // `hotspot` must be within `image` boundaries. + MouseCursor(std::unique_ptr<DesktopFrame> image, + const DesktopVector& hotspot); + + // Deprecated. Use the overload above instead. + // TODO(yuweih): Remove this. // Takes ownership of `image`. `hotspot` must be within `image` boundaries. MouseCursor(DesktopFrame* image, const DesktopVector& hotspot); @@ -33,9 +39,20 @@ class RTC_EXPORT MouseCursor { static MouseCursor* CopyOf(const MouseCursor& cursor); + void set_image(std::unique_ptr<DesktopFrame> image) { + image_ = std::move(image); + } + + // Deprecated. Use the overload above instead. + // TODO(yuweih): Remove this. + // Takes ownership of `image`. void set_image(DesktopFrame* image) { image_.reset(image); } const DesktopFrame* image() const { return image_.get(); } + // Extracts and takes ownership of the underlying cursor image. This is + // useful, e.g., to share the cursor image using SharedDesktopFrame. + std::unique_ptr<DesktopFrame> TakeImage(); + void set_hotspot(const DesktopVector& hotspot) { hotspot_ = hotspot; } const DesktopVector& hotspot() const { return hotspot_; }