From 2f23e06096af618c33e8e0f8b4876d661cca9e1e Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Wed, 15 Jul 2015 11:29:50 -0400 Subject: [PATCH] Backed out changeset 21a5c9152c3b (bug 1183925) for B2G debug mochitest crashes. --- dom/audiochannel/AudioChannelService.cpp | 13 +++++++++++-- dom/audiochannel/AudioChannelService.h | 12 +++++++----- layout/build/nsLayoutStatics.cpp | 2 ++ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/dom/audiochannel/AudioChannelService.cpp b/dom/audiochannel/AudioChannelService.cpp index dc0cb4b17a4..f9431c5dbb1 100644 --- a/dom/audiochannel/AudioChannelService.cpp +++ b/dom/audiochannel/AudioChannelService.cpp @@ -207,7 +207,8 @@ NS_IMPL_ADDREF(AudioChannelService) NS_IMPL_RELEASE(AudioChannelService) AudioChannelService::AudioChannelService() - : mDefChannelChildID(CONTENT_PROCESS_ID_UNKNOWN) + : mDisabled(false) + , mDefChannelChildID(CONTENT_PROCESS_ID_UNKNOWN) , mTelephonyChannel(false) , mContentOrNormalChannel(false) , mAnyChannel(false) @@ -237,6 +238,10 @@ void AudioChannelService::RegisterAudioChannelAgent(AudioChannelAgent* aAgent, AudioChannel aChannel) { + if (mDisabled) { + return; + } + uint64_t windowID = aAgent->WindowID(); AudioChannelWindow* winData = GetWindowData(windowID); if (!winData) { @@ -267,6 +272,10 @@ AudioChannelService::RegisterAudioChannelAgent(AudioChannelAgent* aAgent, void AudioChannelService::UnregisterAudioChannelAgent(AudioChannelAgent* aAgent) { + if (mDisabled) { + return; + } + AudioChannelWindow* winData = GetWindowData(aAgent->WindowID()); if (!winData) { return; @@ -457,8 +466,8 @@ AudioChannelService::Observe(nsISupports* aSubject, const char* aTopic, const char16_t* aData) { if (!strcmp(aTopic, "xpcom-shutdown")) { + mDisabled = true; mWindows.Clear(); - Shutdown(); } #ifdef MOZ_WIDGET_GONK diff --git a/dom/audiochannel/AudioChannelService.h b/dom/audiochannel/AudioChannelService.h index a0a65d8c737..65f312d236b 100644 --- a/dom/audiochannel/AudioChannelService.h +++ b/dom/audiochannel/AudioChannelService.h @@ -43,6 +43,11 @@ public: */ static already_AddRefed GetOrCreate(); + /** + * Shutdown the singleton. + */ + static void Shutdown(); + static bool IsAudioChannelMutedByDefault(); /** @@ -131,11 +136,6 @@ private: AudioChannelService(); ~AudioChannelService(); - /** - * Shutdown the singleton. - */ - static void Shutdown(); - void MaybeSendStatusUpdate(); bool ContentOrNormalChannelIsActive(); @@ -204,6 +204,8 @@ private: nsTArray mSpeakerManager; #endif + bool mDisabled; + nsCOMPtr mRunnable; uint64_t mDefChannelChildID; diff --git a/layout/build/nsLayoutStatics.cpp b/layout/build/nsLayoutStatics.cpp index 1f0111b3937..aeefa16b2f0 100644 --- a/layout/build/nsLayoutStatics.cpp +++ b/layout/build/nsLayoutStatics.cpp @@ -435,6 +435,8 @@ nsLayoutStatics::Shutdown() nsHyphenationManager::Shutdown(); nsDOMMutationObserver::Shutdown(); + AudioChannelService::Shutdown(); + DataStoreService::Shutdown(); ContentParent::ShutDown();