mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1183925 - Part 1: Clean up the SpeakerManagerService shutdown; r=baku
This commit is contained in:
parent
9fcaaf6738
commit
4497e62eeb
@ -179,6 +179,20 @@ SpeakerManagerService::Observe(nsISupports* aSubject,
|
||||
} else {
|
||||
NS_WARNING("ipc:content-shutdown message without childID property");
|
||||
}
|
||||
} else if (!strcmp(aTopic, "xpcom-will-shutdown")) {
|
||||
// Note that we need to do this before xpcom-shutdown, since the
|
||||
// AudioChannelService cannot be used past that point.
|
||||
nsRefPtr<AudioChannelService> audioChannelService =
|
||||
AudioChannelService::GetOrCreate();
|
||||
audioChannelService->UnregisterSpeakerManager(this);
|
||||
|
||||
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
||||
if (obs) {
|
||||
obs->RemoveObserver(this, "ipc:content-shutdown");
|
||||
obs->RemoveObserver(this, "xpcom-will-shutdown");
|
||||
}
|
||||
|
||||
Shutdown();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -192,6 +206,7 @@ SpeakerManagerService::SpeakerManagerService()
|
||||
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
||||
if (obs) {
|
||||
obs->AddObserver(this, "ipc:content-shutdown", false);
|
||||
obs->AddObserver(this, "xpcom-will-shutdown", false);
|
||||
}
|
||||
}
|
||||
nsRefPtr<AudioChannelService> audioChannelService =
|
||||
@ -202,7 +217,4 @@ SpeakerManagerService::SpeakerManagerService()
|
||||
SpeakerManagerService::~SpeakerManagerService()
|
||||
{
|
||||
MOZ_COUNT_DTOR(SpeakerManagerService);
|
||||
nsRefPtr<AudioChannelService> audioChannelService =
|
||||
AudioChannelService::GetOrCreate();
|
||||
audioChannelService->UnregisterSpeakerManager(this);
|
||||
}
|
||||
|
@ -46,10 +46,6 @@ public:
|
||||
{
|
||||
mRegisteredSpeakerManagers.RemoveElement(aSpeakerManager);
|
||||
}
|
||||
/**
|
||||
* Shutdown the singleton.
|
||||
*/
|
||||
static void Shutdown();
|
||||
|
||||
protected:
|
||||
SpeakerManagerService();
|
||||
@ -60,6 +56,11 @@ protected:
|
||||
|
||||
void TurnOnSpeaker(bool aEnable);
|
||||
|
||||
/**
|
||||
* Shutdown the singleton.
|
||||
*/
|
||||
static void Shutdown();
|
||||
|
||||
nsTArray<nsRefPtr<SpeakerManager> > mRegisteredSpeakerManagers;
|
||||
// Set for remember all the child speaker status
|
||||
nsCheapSet<nsUint64HashKey> mSpeakerStatusSet;
|
||||
|
@ -109,7 +109,6 @@
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
#include "nsVolumeService.h"
|
||||
#include "SpeakerManagerService.h"
|
||||
using namespace mozilla::system;
|
||||
#endif
|
||||
|
||||
@ -405,7 +404,6 @@ nsLayoutStatics::Shutdown()
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
nsVolumeService::Shutdown();
|
||||
SpeakerManagerService::Shutdown();
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WEBSPEECH
|
||||
|
Loading…
Reference in New Issue
Block a user