diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-09-11 20:10:43 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-09-11 20:10:43 +0200 |
commit | 2713347f0e0ec3014501c35cd53900732fd27176 (patch) | |
tree | 23d1c8f675ea7582fe3609039f86195764b8bd97 /widget | |
parent | 1bf4a513c8e7fd85642827ce0938b7e1441e5e03 (diff) | |
parent | d086e918b45bbc7a841b46c3d444b2e9d7d7e4c3 (diff) | |
download | UXP-2713347f0e0ec3014501c35cd53900732fd27176.tar UXP-2713347f0e0ec3014501c35cd53900732fd27176.tar.gz UXP-2713347f0e0ec3014501c35cd53900732fd27176.tar.lz UXP-2713347f0e0ec3014501c35cd53900732fd27176.tar.xz UXP-2713347f0e0ec3014501c35cd53900732fd27176.zip |
Merge branch 'ported-upstream'
Diffstat (limited to 'widget')
-rw-r--r-- | widget/windows/WinCompositorWidget.cpp | 8 | ||||
-rw-r--r-- | widget/windows/WinCompositorWidget.h | 4 | ||||
-rw-r--r-- | widget/windows/nsWindowGfx.cpp | 2 |
3 files changed, 14 insertions, 0 deletions
diff --git a/widget/windows/WinCompositorWidget.cpp b/widget/windows/WinCompositorWidget.cpp index f660bd019..99ce67573 100644 --- a/widget/windows/WinCompositorWidget.cpp +++ b/widget/windows/WinCompositorWidget.cpp @@ -22,6 +22,7 @@ using namespace mozilla::gfx; WinCompositorWidget::WinCompositorWidget(const CompositorWidgetInitData& aInitData) : mWidgetKey(aInitData.widgetKey()), mWnd(reinterpret_cast<HWND>(aInitData.hWnd())), + mTransparentSurfaceLock("mTransparentSurfaceLock"), mTransparencyMode(static_cast<nsTransparencyMode>(aInitData.transparencyMode())), mMemoryDC(nullptr), mCompositeDC(nullptr), @@ -39,6 +40,7 @@ WinCompositorWidget::WinCompositorWidget(const CompositorWidgetInitData& aInitDa void WinCompositorWidget::OnDestroyWindow() { + MutexAutoLock lock(mTransparentSurfaceLock); mTransparentSurface = nullptr; mMemoryDC = nullptr; } @@ -75,6 +77,8 @@ WinCompositorWidget::GetClientSize() already_AddRefed<gfx::DrawTarget> WinCompositorWidget::StartRemoteDrawing() { + MutexAutoLock lock(mTransparentSurfaceLock); + MOZ_ASSERT(!mCompositeDC); RefPtr<gfxASurface> surf; @@ -229,6 +233,7 @@ WinCompositorWidget::LeavePresentLock() RefPtr<gfxASurface> WinCompositorWidget::EnsureTransparentSurface() { + mTransparentSurfaceLock.AssertCurrentThreadOwns(); MOZ_ASSERT(mTransparencyMode == eTransparencyTransparent); IntSize size = GetClientSize().ToUnknownSize(); @@ -245,6 +250,7 @@ WinCompositorWidget::EnsureTransparentSurface() void WinCompositorWidget::CreateTransparentSurface(const gfx::IntSize& aSize) { + mTransparentSurfaceLock.AssertCurrentThreadOwns(); MOZ_ASSERT(!mTransparentSurface && !mMemoryDC); RefPtr<gfxWindowsSurface> surface = new gfxWindowsSurface(aSize, SurfaceFormat::A8R8G8B8_UINT32); mTransparentSurface = surface; @@ -254,6 +260,7 @@ WinCompositorWidget::CreateTransparentSurface(const gfx::IntSize& aSize) void WinCompositorWidget::UpdateTransparency(nsTransparencyMode aMode) { + MutexAutoLock lock(mTransparentSurfaceLock); if (mTransparencyMode == aMode) { return; } @@ -270,6 +277,7 @@ WinCompositorWidget::UpdateTransparency(nsTransparencyMode aMode) void WinCompositorWidget::ClearTransparentWindow() { + MutexAutoLock lock(mTransparentSurfaceLock); if (!mTransparentSurface) { return; } diff --git a/widget/windows/WinCompositorWidget.h b/widget/windows/WinCompositorWidget.h index 9661cab45..1689a8641 100644 --- a/widget/windows/WinCompositorWidget.h +++ b/widget/windows/WinCompositorWidget.h @@ -10,6 +10,7 @@ #include "gfxASurface.h" #include "mozilla/gfx/CriticalSection.h" #include "mozilla/gfx/Point.h" +#include "mozilla/Mutex.h" #include "nsIWidget.h" class nsWindow; @@ -83,6 +84,8 @@ public: return mWnd; } + mozilla::Mutex& GetTransparentSurfaceLock() { return mTransparentSurfaceLock; } + private: HDC GetWindowSurface(); void FreeWindowSurface(HDC dc); @@ -95,6 +98,7 @@ private: gfx::CriticalSection mPresentLock; // Transparency handling. + mozilla::Mutex mTransparentSurfaceLock; nsTransparencyMode mTransparencyMode; RefPtr<gfxASurface> mTransparentSurface; HDC mMemoryDC; diff --git a/widget/windows/nsWindowGfx.cpp b/widget/windows/nsWindowGfx.cpp index a88631f89..9b303a0f2 100644 --- a/widget/windows/nsWindowGfx.cpp +++ b/widget/windows/nsWindowGfx.cpp @@ -320,6 +320,8 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel) #if defined(MOZ_XUL) // don't support transparency for non-GDI rendering, for now if (eTransparencyTransparent == mTransparencyMode) { + // This mutex needs to be held when EnsureTransparentSurface is called. + MutexAutoLock lock(mBasicLayersSurface->GetTransparentSurfaceLock()); targetSurface = mBasicLayersSurface->EnsureTransparentSurface(); } #endif |