зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset a0c4559f5d2e for cpp unitest orange
This commit is contained in:
Родитель
d5dbd9640b
Коммит
ec419c6c8a
|
@ -67,7 +67,6 @@ NS_IMPL_ISUPPORTS0(AudioChannelService)
|
|||
|
||||
AudioChannelService::AudioChannelService()
|
||||
: mCurrentHigherChannel(AUDIO_CHANNEL_LAST)
|
||||
, mActiveContentChildIDsFrozen(false)
|
||||
{
|
||||
// Creation of the hash table.
|
||||
mAgents.Init();
|
||||
|
@ -170,27 +169,6 @@ AudioChannelService::GetMutedInternal(AudioChannelType aType, uint64_t aChildID,
|
|||
mChannelCounters[oldType].RemoveElement(aChildID);
|
||||
}
|
||||
|
||||
// If the audio content channel is visible, let's remember this ChildID.
|
||||
if (newType == AUDIO_CHANNEL_INT_CONTENT &&
|
||||
oldType == AUDIO_CHANNEL_INT_CONTENT_HIDDEN &&
|
||||
!mActiveContentChildIDs.Contains(aChildID)) {
|
||||
|
||||
if (mActiveContentChildIDsFrozen) {
|
||||
mActiveContentChildIDsFrozen = false;
|
||||
mActiveContentChildIDs.Clear();
|
||||
}
|
||||
|
||||
mActiveContentChildIDs.AppendElement(aChildID);
|
||||
}
|
||||
|
||||
// If nothing is visible, the list has to been frozen.
|
||||
else if (newType == AUDIO_CHANNEL_INT_CONTENT_HIDDEN &&
|
||||
oldType == AUDIO_CHANNEL_INT_CONTENT &&
|
||||
!mActiveContentChildIDsFrozen &&
|
||||
mChannelCounters[AUDIO_CHANNEL_INT_CONTENT].IsEmpty()) {
|
||||
mActiveContentChildIDsFrozen = true;
|
||||
}
|
||||
|
||||
// Let play any visible audio channel.
|
||||
if (!aElementHidden) {
|
||||
return false;
|
||||
|
@ -201,7 +179,8 @@ AudioChannelService::GetMutedInternal(AudioChannelType aType, uint64_t aChildID,
|
|||
// We are not visible, maybe we have to mute.
|
||||
if (newType == AUDIO_CHANNEL_INT_NORMAL_HIDDEN ||
|
||||
(newType == AUDIO_CHANNEL_INT_CONTENT_HIDDEN &&
|
||||
!mActiveContentChildIDs.Contains(aChildID))) {
|
||||
(!mChannelCounters[AUDIO_CHANNEL_INT_CONTENT].IsEmpty() ||
|
||||
HasMoreThanOneContentChannelHidden()))) {
|
||||
muted = true;
|
||||
}
|
||||
|
||||
|
@ -220,6 +199,25 @@ AudioChannelService::ContentChannelIsActive()
|
|||
!mChannelCounters[AUDIO_CHANNEL_INT_CONTENT_HIDDEN].IsEmpty();
|
||||
}
|
||||
|
||||
bool
|
||||
AudioChannelService::HasMoreThanOneContentChannelHidden()
|
||||
{
|
||||
uint32_t childId = CONTENT_PARENT_UNKNOWN_CHILD_ID;
|
||||
bool empty = true;
|
||||
for (uint32_t i = 0;
|
||||
i < mChannelCounters[AUDIO_CHANNEL_INT_CONTENT_HIDDEN].Length();
|
||||
++i) {
|
||||
if (empty) {
|
||||
childId = mChannelCounters[AUDIO_CHANNEL_INT_CONTENT_HIDDEN][i];
|
||||
empty = false;
|
||||
} else if (childId != mChannelCounters[AUDIO_CHANNEL_INT_CONTENT_HIDDEN][i]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
AudioChannelService::SendAudioChannelChangedNotification()
|
||||
{
|
||||
|
@ -281,7 +279,8 @@ AudioChannelService::SendAudioChannelChangedNotification()
|
|||
}
|
||||
|
||||
// Content channels play in background if just one is active.
|
||||
else if (!mActiveContentChildIDs.IsEmpty()) {
|
||||
else if ((!mChannelCounters[AUDIO_CHANNEL_INT_CONTENT_HIDDEN].IsEmpty() &&
|
||||
!HasMoreThanOneContentChannelHidden())) {
|
||||
higher = AUDIO_CHANNEL_CONTENT;
|
||||
}
|
||||
|
||||
|
@ -392,10 +391,6 @@ AudioChannelService::Observe(nsISupports* aSubject, const char* aTopic, const PR
|
|||
while ((index = mChannelCounters[type].IndexOf(childID)) != -1) {
|
||||
mChannelCounters[type].RemoveElementAt(index);
|
||||
}
|
||||
|
||||
if ((index = mActiveContentChildIDs.IndexOf(childID)) != -1) {
|
||||
mActiveContentChildIDs.RemoveElementAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
// We don't have to remove the agents from the mAgents hashtable because if
|
||||
|
|
|
@ -98,6 +98,8 @@ protected:
|
|||
|
||||
bool ChannelsActiveWithHigherPriorityThan(AudioChannelInternalType aType);
|
||||
|
||||
bool HasMoreThanOneContentChannelHidden();
|
||||
|
||||
const char* ChannelName(AudioChannelType aType);
|
||||
|
||||
AudioChannelInternalType GetInternalType(AudioChannelType aType,
|
||||
|
@ -128,9 +130,6 @@ protected:
|
|||
|
||||
AudioChannelType mCurrentHigherChannel;
|
||||
|
||||
nsTArray<uint64_t> mActiveContentChildIDs;
|
||||
bool mActiveContentChildIDsFrozen;
|
||||
|
||||
// This is needed for IPC comunication between
|
||||
// AudioChannelServiceChild and this class.
|
||||
friend class ContentParent;
|
||||
|
|
Загрузка…
Ссылка в новой задаче