This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch geckoview-102.3.0esr-12.0-1 in repository tor-browser.
commit bfcf5e8ea73200782ac78c740b61b3692a7a51ba Author: David Parks daparks@mozilla.com AuthorDate: Fri Jul 29 19:32:14 2022 +0000
Bug 1755700: Use StartAudioSession and StopAudioSession symmetrically r=cmartin, a=RyanVM
Moves StopAudioSession earlier -- to nsAppShell::Run -- where we call StartAudioSession.
Differential Revision: https://phabricator.services.mozilla.com/D152299 --- toolkit/xre/nsAppRunner.cpp | 13 ------------- widget/windows/nsAppShell.cpp | 16 +++++++++------- 2 files changed, 9 insertions(+), 20 deletions(-)
diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 8b6b91d826dd3..79baf84160830 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -117,7 +117,6 @@ # include "mozilla/WinHeaderOnlyUtils.h" # include "mozilla/mscom/ProcessRuntime.h" # include "mozilla/mscom/ProfilerMarkers.h" -# include "mozilla/widget/AudioSession.h" # include "WinTokenUtils.h"
# if defined(MOZ_LAUNCHER_PROCESS) @@ -5943,18 +5942,6 @@ int XREMain::XRE_main(int argc, char* argv[], const BootstrapConfig& aConfig) { XRE_CleanupX11ErrorHandler(); #endif
-#if defined(XP_WIN) - bool wantAudio = true; -# ifdef MOZ_BACKGROUNDTASKS - if (BackgroundTasks::IsBackgroundTaskMode()) { - wantAudio = false; - } -# endif - if (MOZ_LIKELY(wantAudio)) { - mozilla::widget::StopAudioSession(); - } -#endif - #ifdef MOZ_INSTRUMENT_EVENT_LOOP mozilla::ShutdownEventTracing(); #endif diff --git a/widget/windows/nsAppShell.cpp b/widget/windows/nsAppShell.cpp index 664977a83028a..07f28b1d3308b 100644 --- a/widget/windows/nsAppShell.cpp +++ b/widget/windows/nsAppShell.cpp @@ -589,8 +589,8 @@ nsresult nsAppShell::Init() {
NS_IMETHODIMP nsAppShell::Run(void) { + bool wantAudio = true; if (XRE_IsParentProcess()) { - bool wantAudio = true; #ifdef MOZ_BACKGROUNDTASKS if (BackgroundTasks::IsBackgroundTaskMode()) { wantAudio = false; @@ -599,13 +599,11 @@ nsAppShell::Run(void) { if (MOZ_LIKELY(wantAudio)) { mozilla::widget::StartAudioSession(); } - }
- // Add an observer that disables the screen saver when requested by Gecko. - // For example when we're playing video in the foreground tab. Whole firefox - // only needs one wakelock instance, so we would only create one listener in - // chrome process to prevent requesting unnecessary wakelock. - if (XRE_IsParentProcess()) { + // Add an observer that disables the screen saver when requested by Gecko. + // For example when we're playing video in the foreground tab. Whole firefox + // only needs one wakelock instance, so we would only create one listener in + // chrome process to prevent requesting unnecessary wakelock. AddScreenWakeLockListener(); }
@@ -613,6 +611,10 @@ nsAppShell::Run(void) {
if (XRE_IsParentProcess()) { RemoveScreenWakeLockListener(); + + if (MOZ_LIKELY(wantAudio)) { + mozilla::widget::StopAudioSession(); + } }
return rv;