Bug 1183925 - Clean up the AudioChannelService shutdown; r=baku

Right now this function is called after the XPCOM component manager is
shut down, so it can never remove any observers.  It's better to do this
work in response to xpcom-shutdown while we still have a component
manager to be able to clean up after ourselves properly.
This commit is contained in:
Ehsan Akhgari 2015-07-14 20:16:21 -04:00
Родитель 2cdd3a4561
Коммит 892a26b362
3 изменённых файлов: 7 добавлений и 20 удалений

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

@ -207,8 +207,7 @@ NS_IMPL_ADDREF(AudioChannelService)
NS_IMPL_RELEASE(AudioChannelService)
AudioChannelService::AudioChannelService()
: mDisabled(false)
, mDefChannelChildID(CONTENT_PROCESS_ID_UNKNOWN)
: mDefChannelChildID(CONTENT_PROCESS_ID_UNKNOWN)
, mTelephonyChannel(false)
, mContentOrNormalChannel(false)
, mAnyChannel(false)
@ -238,10 +237,6 @@ void
AudioChannelService::RegisterAudioChannelAgent(AudioChannelAgent* aAgent,
AudioChannel aChannel)
{
if (mDisabled) {
return;
}
uint64_t windowID = aAgent->WindowID();
AudioChannelWindow* winData = GetWindowData(windowID);
if (!winData) {
@ -272,10 +267,6 @@ AudioChannelService::RegisterAudioChannelAgent(AudioChannelAgent* aAgent,
void
AudioChannelService::UnregisterAudioChannelAgent(AudioChannelAgent* aAgent)
{
if (mDisabled) {
return;
}
AudioChannelWindow* winData = GetWindowData(aAgent->WindowID());
if (!winData) {
return;
@ -466,8 +457,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

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

@ -43,11 +43,6 @@ public:
*/
static already_AddRefed<AudioChannelService> GetOrCreate();
/**
* Shutdown the singleton.
*/
static void Shutdown();
static bool IsAudioChannelMutedByDefault();
/**
@ -136,6 +131,11 @@ private:
AudioChannelService();
~AudioChannelService();
/**
* Shutdown the singleton.
*/
static void Shutdown();
void MaybeSendStatusUpdate();
bool ContentOrNormalChannelIsActive();
@ -204,8 +204,6 @@ private:
nsTArray<SpeakerManagerService*> mSpeakerManager;
#endif
bool mDisabled;
nsCOMPtr<nsIRunnable> mRunnable;
uint64_t mDefChannelChildID;

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

@ -435,8 +435,6 @@ nsLayoutStatics::Shutdown()
nsHyphenationManager::Shutdown();
nsDOMMutationObserver::Shutdown();
AudioChannelService::Shutdown();
DataStoreService::Shutdown();
ContentParent::ShutDown();