tor-browser

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

commit 9e9e4fadc7b4de74afc45e7e03198d0b14823fb6
parent 2d3eb0655bcdf9b67117a3f3fb36dd6c0a0ad246
Author: Markus Stange <mstange.moz@gmail.com>
Date:   Thu,  9 Oct 2025 18:11:57 +0000

Bug 1993383 - Trigger a repaint of the window in the parent process after a GPU process crash. r=bradwerth

Differential Revision: https://phabricator.services.mozilla.com/D268052

Diffstat:
Mwidget/cocoa/nsCocoaWindow.h | 2++
Mwidget/cocoa/nsCocoaWindow.mm | 24++++++++++++++++++++++++
2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/widget/cocoa/nsCocoaWindow.h b/widget/cocoa/nsCocoaWindow.h @@ -392,6 +392,8 @@ class nsCocoaWindow final : public nsBaseWidget { void CreateCompositor(int aWidth, int aHeight) override; void DestroyCompositor() override; + void NotifyCompositorSessionLost( + mozilla::layers::CompositorSession* aSession) override; void SetCompositorWidgetDelegate( mozilla::widget::CompositorWidgetDelegate*) override; diff --git a/widget/cocoa/nsCocoaWindow.mm b/widget/cocoa/nsCocoaWindow.mm @@ -974,6 +974,30 @@ void nsCocoaWindow::DestroyCompositor() { nsBaseWidget::DestroyCompositor(); } +void nsCocoaWindow::NotifyCompositorSessionLost( + mozilla::layers::CompositorSession* aSession) { + // The GPU process has crashed. + // + // Trigger a repaint of this window. + // Without this, WebRender won't receive a display list for this + // window until something else triggers a parent-side repaint. So tab + // contents would remain frozen until the user moves the mouse over a + // UI element, for example. + // + // The Windows equivalent to this code is InvalidateWindowForDeviceReset. + // + // We wait for a short time before the repaint in order to avoid + // flashing tab content - if we were to trigger the parent-side paint + // immediately, the composite would briefly hide the tab contents because + // the new compositor won't have a display list for the tab yet. + const double kTriggerPaintDelayAfterGpuProcessCrash = 0.4; // 400ms + [mChildView performSelector:@selector(markLayerForDisplay) + withObject:nil + afterDelay:kTriggerPaintDelayAfterGpuProcessCrash]; + + nsBaseWidget::NotifyCompositorSessionLost(aSession); +} + void nsCocoaWindow::SetCompositorWidgetDelegate( mozilla::widget::CompositorWidgetDelegate* aDelegate) { if (aDelegate) {