Bug 1710486 - Fix InProcessWinCompositorWidget locking to always release the present lock. r=cmartin

Otherwise we may hang when drawing transparent popups.

Differential Revision: https://phabricator.services.mozilla.com/D114766
This commit is contained in:
Emilio Cobos Alvarez 2021-05-10 18:52:59 +00:00
Родитель 525d4000cd
Коммит 6a9de4ee42
1 изменённых файлов: 3 добавлений и 6 удалений

Просмотреть файл

@ -66,11 +66,10 @@ InProcessWinCompositorWidget::InProcessWinCompositorWidget(
}
void InProcessWinCompositorWidget::OnDestroyWindow() {
EnterPresentLock();
gfx::CriticalSectionAutoEnter presentLock(&mPresentLock);
MutexAutoLock lock(mTransparentSurfaceLock);
mTransparentSurface = nullptr;
mMemoryDC = nullptr;
LeavePresentLock();
}
bool InProcessWinCompositorWidget::OnWindowResize(
@ -266,7 +265,7 @@ void InProcessWinCompositorWidget::CreateTransparentSurface(
void InProcessWinCompositorWidget::UpdateTransparency(
nsTransparencyMode aMode) {
EnterPresentLock();
gfx::CriticalSectionAutoEnter presentLock(&mPresentLock);
MutexAutoLock lock(mTransparentSurfaceLock);
if (mTransparencyMode == aMode) {
return;
@ -279,7 +278,6 @@ void InProcessWinCompositorWidget::UpdateTransparency(
if (mTransparencyMode == eTransparencyTransparent) {
EnsureTransparentSurface();
}
LeavePresentLock();
}
bool InProcessWinCompositorWidget::HasGlass() const {
@ -292,7 +290,7 @@ bool InProcessWinCompositorWidget::HasGlass() const {
}
void InProcessWinCompositorWidget::ClearTransparentWindow() {
EnterPresentLock();
gfx::CriticalSectionAutoEnter presentLock(&mPresentLock);
MutexAutoLock lock(mTransparentSurfaceLock);
if (!mTransparentSurface) {
return;
@ -310,7 +308,6 @@ void InProcessWinCompositorWidget::ClearTransparentWindow() {
drawTarget->ClearRect(Rect(0, 0, size.width, size.height));
RedrawTransparentWindow();
}
LeavePresentLock();
}
bool InProcessWinCompositorWidget::RedrawTransparentWindow() {