Bug 1820204 - Simplify some wayland vsync code. r=rmader

That code only runs in the parent process by design. And we use
infallible new so there's no need to release-assert that allocation
succeeded.

Differential Revision: https://phabricator.services.mozilla.com/D171579
This commit is contained in:
Emilio Cobos Álvarez 2023-03-03 20:47:51 +00:00
Родитель ec84fd2378
Коммит f66702754b
1 изменённых файлов: 10 добавлений и 14 удалений

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

@ -3718,18 +3718,15 @@ void nsWindow::CreateCompositorVsyncDispatcher() {
nsBaseWidget::CreateCompositorVsyncDispatcher(); nsBaseWidget::CreateCompositorVsyncDispatcher();
return; return;
} }
if (!mCompositorVsyncDispatcherLock) {
if (XRE_IsParentProcess()) { mCompositorVsyncDispatcherLock =
if (!mCompositorVsyncDispatcherLock) { MakeUnique<Mutex>("mCompositorVsyncDispatcherLock");
mCompositorVsyncDispatcherLock = }
MakeUnique<Mutex>("mCompositorVsyncDispatcherLock"); MutexAutoLock lock(*mCompositorVsyncDispatcherLock);
} if (!mCompositorVsyncDispatcher) {
MutexAutoLock lock(*mCompositorVsyncDispatcherLock); LOG_VSYNC(" create CompositorVsyncDispatcher()");
if (!mCompositorVsyncDispatcher) { mCompositorVsyncDispatcher =
LOG_VSYNC(" create CompositorVsyncDispatcher()"); new CompositorVsyncDispatcher(mWaylandVsyncDispatcher);
mCompositorVsyncDispatcher =
new CompositorVsyncDispatcher(mWaylandVsyncDispatcher);
}
} }
} }
#endif #endif
@ -6289,8 +6286,7 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
mWindowType == WindowType::TopLevel) { mWindowType == WindowType::TopLevel) {
mWaylandVsyncSource = new WaylandVsyncSource(this); mWaylandVsyncSource = new WaylandVsyncSource(this);
mWaylandVsyncDispatcher = new VsyncDispatcher(mWaylandVsyncSource); mWaylandVsyncDispatcher = new VsyncDispatcher(mWaylandVsyncSource);
LOG_VSYNC(" created WaylandVsyncSource)"); LOG_VSYNC(" created WaylandVsyncSource");
MOZ_RELEASE_ASSERT(mWaylandVsyncSource);
} }
#endif #endif