tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 3e242617348362bc707dcaf113ceee4a62b84e40
parent 1db8be28fcb0540e9e0cc3e355ab48d209b9a212
Author: Andrew Osmond <aosmond@gmail.com>
Date:   Thu,  9 Oct 2025 23:46:46 +0000

Bug 1993558 - Remove call to EnsureGPUReady in GPUProcessManager::NotifyGpuObservers. r=gfx-reviewers,lsalzman

This is only used by APZ right now, and if the GPU process had to be
launched to dispatch this observer event, there would have been no state
to update, so we can just refuse to dispatch.

Differential Revision: https://phabricator.services.mozilla.com/D268196

Diffstat:
Mgfx/ipc/GPUProcessManager.cpp | 23++++++++++++++++++-----
Mgfx/layers/apz/util/CheckerboardReportService.cpp | 10+++++++---
2 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/gfx/ipc/GPUProcessManager.cpp b/gfx/ipc/GPUProcessManager.cpp @@ -1687,12 +1687,25 @@ void GPUProcessManager::RemoveListener(GPUProcessListener* aListener) { } bool GPUProcessManager::NotifyGpuObservers(const char* aTopic) { - if (NS_FAILED(EnsureGPUReady())) { - return false; + if (mGPUChild) { + nsCString topic(aTopic); + mGPUChild->SendNotifyGpuObservers(topic); + return true; } - nsCString topic(aTopic); - mGPUChild->SendNotifyGpuObservers(topic); - return true; + + if (!gfxConfig::IsEnabled(Feature::GPU_PROCESS)) { + nsCOMPtr<nsIObserverService> obsSvc = + mozilla::services::GetObserverService(); + MOZ_ASSERT(obsSvc); + if (obsSvc) { + obsSvc->NotifyObservers(nullptr, aTopic, nullptr); + } + return true; + } + + // If we still are using a GPU process, but do not have one ready at the + // moment, we can drop these notifications since there is nothing to do. + return false; } class GPUMemoryReporter : public MemoryReportingProcess { diff --git a/gfx/layers/apz/util/CheckerboardReportService.cpp b/gfx/layers/apz/util/CheckerboardReportService.cpp @@ -201,15 +201,19 @@ void CheckerboardReportService::SetRecordingEnabled(bool aEnabled) { void CheckerboardReportService::FlushActiveReports() { MOZ_ASSERT(XRE_IsParentProcess()); - gfx::GPUProcessManager* gpu = gfx::GPUProcessManager::Get(); - if (gpu && gpu->NotifyGpuObservers("APZ:FlushActiveCheckerboard")) { + gfx::GPUProcessManager* gpm = gfx::GPUProcessManager::Get(); + if (gpm && gpm->NotifyGpuObservers("APZ:FlushActiveCheckerboard")) { return; } + // We failed to dispatch the observer event, either because we have shutdown + // or the GPU process is temporarily down. In that case, let the callers know + // we are done. nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService(); MOZ_ASSERT(obsSvc); if (obsSvc) { - obsSvc->NotifyObservers(nullptr, "APZ:FlushActiveCheckerboard", nullptr); + obsSvc->NotifyObservers(nullptr, "APZ:FlushActiveCheckerboard:Done", + nullptr); } }