Bug 1768241 - Fall back to the global vsync dispatcher when we're on Wayland and there's no widget-local dispatcher.

This is fixing an oversight in a patch that was supposed to be functionally neutral.
https://hg.mozilla.org/mozilla-central/rev/22b568631834e556ab8351ac8458d5b24aa638bd#l1.49

The old code always called UpdateVsyncDispatcher, even if the widget's vsync
source was null, and then UpdateVsyncDispatcher fell back to using the global
vsync source when null was passed.
The new code skipped the call entirely when the vsync dispatcher was null,
so it prevented fallback to the global vsync dispatcher.
Now with this patch, we correctly fall back to the global vsync
dispatcher if the widget's dispatcher is null.

This code only runs on Linux wayland; on other platforms, BrowserParent::mVsyncParent
is always null because nothing calls AllocPVsyncParent.

Differential Revision: https://phabricator.services.mozilla.com/D145807
This commit is contained in:
Markus Stange 2022-05-07 22:20:50 +00:00
Родитель c7183440fe
Коммит 192bc117c6
2 изменённых файлов: 8 добавлений и 3 удалений

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

@ -1450,10 +1450,11 @@ void BrowserParent::UpdateVsyncParentVsyncDispatcher() {
}
if (nsCOMPtr<nsIWidget> widget = GetWidget()) {
if (RefPtr<VsyncDispatcher> vsyncDispatcher =
widget->GetVsyncDispatcher()) {
mVsyncParent->UpdateVsyncDispatcher(vsyncDispatcher);
RefPtr<VsyncDispatcher> vsyncDispatcher = widget->GetVsyncDispatcher();
if (!vsyncDispatcher) {
vsyncDispatcher = gfxPlatform::GetPlatform()->GetGlobalVsyncDispatcher();
}
mVsyncParent->UpdateVsyncDispatcher(vsyncDispatcher);
}
}

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

@ -22,6 +22,10 @@ VsyncParent::VsyncParent()
void VsyncParent::UpdateVsyncDispatcher(
const RefPtr<VsyncDispatcher>& aVsyncDispatcher) {
if (aVsyncDispatcher == mVsyncDispatcher) {
return;
}
if (mObservingVsync && mVsyncDispatcher) {
mVsyncDispatcher->RemoveVsyncObserver(this);
}