From e0de8181d9d51cff079f9b54fd6fa276d6aeb094 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Thu, 1 Nov 2018 20:16:11 +0100 Subject: Protect main thread in-process access to WinCompositorWidget transparent surface. --- widget/windows/InProcessWinCompositorWidget.cpp | 25 +++++++++++++++++++++++++ widget/windows/InProcessWinCompositorWidget.h | 4 ++++ 2 files changed, 29 insertions(+) (limited to 'widget') diff --git a/widget/windows/InProcessWinCompositorWidget.cpp b/widget/windows/InProcessWinCompositorWidget.cpp index 685eaf5ca6..a11790b328 100644 --- a/widget/windows/InProcessWinCompositorWidget.cpp +++ b/widget/windows/InProcessWinCompositorWidget.cpp @@ -23,6 +23,31 @@ InProcessWinCompositorWidget::InProcessWinCompositorWidget(const CompositorWidge MOZ_ASSERT(mWindow); } +void +InProcessWinCompositorWidget::OnDestroyWindow() +{ + EnterPresentLock(); + WinCompositorWidget::OnDestroyWindow(); + LeavePresentLock(); +} + +void +InProcessWinCompositorWidget::UpdateTransparency(nsTransparencyMode aMode) +{ + EnterPresentLock(); + WinCompositorWidget::UpdateTransparency(aMode); + LeavePresentLock(); +} + +void +InProcessWinCompositorWidget::ClearTransparentWindow() +{ + EnterPresentLock(); + WinCompositorWidget::ClearTransparentWindow(); + LeavePresentLock(); +} + + nsIWidget* InProcessWinCompositorWidget::RealWidget() { diff --git a/widget/windows/InProcessWinCompositorWidget.h b/widget/windows/InProcessWinCompositorWidget.h index 2ce6ba0be1..afe5a7f535 100644 --- a/widget/windows/InProcessWinCompositorWidget.h +++ b/widget/windows/InProcessWinCompositorWidget.h @@ -22,6 +22,10 @@ class InProcessWinCompositorWidget final : public WinCompositorWidget public: InProcessWinCompositorWidget(const CompositorWidgetInitData& aInitData, nsWindow* aWindow); + void OnDestroyWindow() override; + void UpdateTransparency(nsTransparencyMode aMode) override; + void ClearTransparentWindow() override; + void ObserveVsync(VsyncObserver* aObserver) override; nsIWidget* RealWidget() override; -- cgit v1.2.3