Bug 1338137 - part2 : remove function IsServiceStarted().
The reason we introduced the IsServiceStarted(), check bug1338466 comment5 for
more details.
The patch1 introduces more robust way to check the alive media component, so
we can remove IsServiceStarted().
MozReview-Commit-ID: LIma8hZTuhA
--- a/dom/audiochannel/AudioChannelService.cpp
+++ b/dom/audiochannel/AudioChannelService.cpp
@@ -198,23 +198,16 @@ AudioChannelService::CreateServiceIfNeed
{
MOZ_ASSERT(NS_IsMainThread());
if (!gAudioChannelService) {
gAudioChannelService = new AudioChannelService();
}
}
-/* static */ bool
-AudioChannelService::IsServiceStarted()
-{
- // The service would start when the first AudioChannelAgent is created.
- return !!gAudioChannelService;
-}
-
/* static */ already_AddRefed<AudioChannelService>
AudioChannelService::GetOrCreate()
{
if (sXPCOMShuttingDown) {
return nullptr;
}
CreateServiceIfNeeded();
--- a/dom/audiochannel/AudioChannelService.h
+++ b/dom/audiochannel/AudioChannelService.h
@@ -101,18 +101,16 @@ public:
static already_AddRefed<AudioChannelService> Get();
static bool IsAudioChannelMutedByDefault();
static PRLogModuleInfo* GetAudioChannelLog();
static bool IsEnableAudioCompeting();
- static bool IsServiceStarted();
-
/**
* Any audio channel agent that starts playing should register itself to
* this service, sharing the AudioChannel.
*/
void RegisterAudioChannelAgent(AudioChannelAgent* aAgent,
AudibleState aAudible);
/**
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -4236,18 +4236,17 @@ nsPIDOMWindowOuter::MaybeActiveMediaComp
}
nsCOMPtr<nsIDocument> doc = inner->GetExtantDoc();
if (!doc) {
return;
}
if (!doc->Hidden() &&
- mMediaSuspend == nsISuspendedTypes::SUSPENDED_BLOCK &&
- AudioChannelService::IsServiceStarted()) {
+ mMediaSuspend == nsISuspendedTypes::SUSPENDED_BLOCK) {
SetMediaSuspend(nsISuspendedTypes::NONE_SUSPENDED);
}
}
SuspendTypes
nsPIDOMWindowOuter::GetMediaSuspend() const
{
if (IsInnerWindow()) {