--- a/browser/base/content/test/general/browser_audioTabIcon.js
+++ b/browser/base/content/test/general/browser_audioTabIcon.js
@@ -291,19 +291,19 @@ async function test_swapped_browser_whil
let AttrChangePromise = BrowserTestUtils.waitForEvent(newTab, "TabAttrModified", false, event => {
return event.detail.changed.includes("muted");
});
let AudioPlaybackPromise = new Promise(resolve => {
let observer = (subject, topic, data) => {
ok(false, "Should not see an audio-playback notification");
};
- Services.obs.addObserver(observer, "audiochannel-activity-normal");
+ Services.obs.addObserver(observer, "audio-playback");
setTimeout(() => {
- Services.obs.removeObserver(observer, "audiochannel-activity-normal");
+ Services.obs.removeObserver(observer, "audio-playback");
resolve();
}, 100);
});
gBrowser.swapBrowsersAndCloseOther(newTab, oldTab);
await AttrChangePromise;
ok(newTab.hasAttribute("muted"), "Expected the correct muted attribute on the new tab");
--- a/dom/audiochannel/AudioChannelService.cpp
+++ b/dom/audiochannel/AudioChannelService.cpp
@@ -7,20 +7,16 @@
#include "AudioChannelService.h"
#include "base/basictypes.h"
#include "mozilla/Services.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/Unused.h"
-#include "mozilla/dom/ContentChild.h"
-#include "mozilla/dom/ContentParent.h"
-#include "mozilla/dom/TabParent.h"
-
#include "nsContentUtils.h"
#include "nsIScriptSecurityManager.h"
#include "nsISupportsPrimitives.h"
#include "nsThreadUtils.h"
#include "nsHashPropertyBag.h"
#include "nsComponentManagerUtils.h"
#include "nsGlobalWindow.h"
#include "nsPIDOMWindow.h"
@@ -29,36 +25,31 @@
#ifdef MOZ_WIDGET_GONK
#include "nsJSUtils.h"
#endif
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
-using namespace mozilla::hal;
static mozilla::LazyLogModule gAudioChannelLog("AudioChannel");
namespace {
-// If true, any new AudioChannelAgent will be muted when created.
-bool sAudioChannelMutedByDefault = false;
bool sAudioChannelCompeting = false;
bool sAudioChannelCompetingAllAgents = false;
bool sXPCOMShuttingDown = false;
class NotifyChannelActiveRunnable final : public Runnable
{
public:
- NotifyChannelActiveRunnable(uint64_t aWindowID, AudioChannel aAudioChannel,
- bool aActive)
+ NotifyChannelActiveRunnable(uint64_t aWindowID, bool aActive)
: Runnable("NotifyChannelActiveRunnable")
, mWindowID(aWindowID)
- , mAudioChannel(aAudioChannel)
, mActive(aActive)
{}
NS_IMETHOD Run() override
{
nsCOMPtr<nsIObserverService> observerService =
services::GetObserverService();
if (NS_WARN_IF(!observerService)) {
@@ -68,45 +59,31 @@ public:
nsCOMPtr<nsISupportsPRUint64> wrapper =
do_CreateInstance(NS_SUPPORTS_PRUINT64_CONTRACTID);
if (NS_WARN_IF(!wrapper)) {
return NS_ERROR_FAILURE;
}
wrapper->SetData(mWindowID);
- nsAutoString name;
- AudioChannelService::GetAudioChannelString(mAudioChannel, name);
-
- nsAutoCString topic;
- topic.Assign("audiochannel-activity-");
- topic.Append(NS_ConvertUTF16toUTF8(name));
-
- observerService->NotifyObservers(wrapper, topic.get(),
- mActive
- ? u"active"
- : u"inactive");
-
- // TODO : remove b2g related event in bug1299390.
observerService->NotifyObservers(wrapper,
"media-playback",
mActive
? u"active"
: u"inactive");
MOZ_LOG(AudioChannelService::GetAudioChannelLog(), LogLevel::Debug,
- ("NotifyChannelActiveRunnable, type = %" PRIu32 ", active = %s\n",
- static_cast<uint32_t>(mAudioChannel), mActive ? "true" : "false"));
+ ("NotifyChannelActiveRunnable, active = %s\n",
+ mActive ? "true" : "false"));
return NS_OK;
}
private:
const uint64_t mWindowID;
- const AudioChannel mAudioChannel;
const bool mActive;
};
bool
IsParentProcess()
{
return XRE_GetProcessType() == GeckoProcessType_Default;
}
@@ -310,18 +287,16 @@ AudioChannelService::Shutdown()
obs->RemoveObserver(gAudioChannelService, "outer-window-destroyed");
if (IsParentProcess()) {
obs->RemoveObserver(gAudioChannelService, "ipc:content-shutdown");
}
}
gAudioChannelService->mWindows.Clear();
- gAudioChannelService->mPlayingChildren.Clear();
- gAudioChannelService->mTabParents.Clear();
gAudioChannelService = nullptr;
}
}
/* static */ bool
AudioChannelService::IsEnableAudioCompeting()
{
@@ -333,32 +308,23 @@ NS_INTERFACE_MAP_BEGIN(AudioChannelServi
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIObserver)
NS_INTERFACE_MAP_ENTRY(nsIObserver)
NS_INTERFACE_MAP_END
NS_IMPL_ADDREF(AudioChannelService)
NS_IMPL_RELEASE(AudioChannelService)
AudioChannelService::AudioChannelService()
- : mDefChannelChildID(CONTENT_PROCESS_ID_UNKNOWN)
- , mTelephonyChannel(false)
- , mContentOrNormalChannel(false)
- , mAnyChannel(false)
{
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
obs->AddObserver(this, "xpcom-shutdown", false);
obs->AddObserver(this, "outer-window-destroyed", false);
- if (IsParentProcess()) {
- obs->AddObserver(this, "ipc:content-shutdown", false);
- }
}
- Preferences::AddBoolVarCache(&sAudioChannelMutedByDefault,
- "dom.audiochannel.mutedByDefault");
Preferences::AddBoolVarCache(&sAudioChannelCompeting,
"dom.audiochannel.audioCompeting");
Preferences::AddBoolVarCache(&sAudioChannelCompetingAllAgents,
"dom.audiochannel.audioCompeting.allAgents");
}
AudioChannelService::~AudioChannelService()
{
@@ -390,18 +356,16 @@ AudioChannelService::RegisterAudioChanne
mWindows.AppendElement(winData);
}
// To make sure agent would be alive because AppendAgent() would trigger the
// callback function of AudioChannelAgentOwner that means the agent might be
// released in their callback.
RefPtr<AudioChannelAgent> kungFuDeathGrip(aAgent);
winData->AppendAgent(aAgent, aAudible);
-
- MaybeSendStatusUpdate();
}
void
AudioChannelService::UnregisterAudioChannelAgent(AudioChannelAgent* aAgent)
{
MOZ_ASSERT(aAgent);
AudioChannelWindow* winData = GetWindowData(aAgent->WindowID());
@@ -409,33 +373,16 @@ AudioChannelService::UnregisterAudioChan
return;
}
// To make sure agent would be alive because AppendAgent() would trigger the
// callback function of AudioChannelAgentOwner that means the agent might be
// released in their callback.
RefPtr<AudioChannelAgent> kungFuDeathGrip(aAgent);
winData->RemoveAgent(aAgent);
-
- MaybeSendStatusUpdate();
-}
-
-void
-AudioChannelService::RegisterTabParent(TabParent* aTabParent)
-{
- MOZ_ASSERT(aTabParent);
- MOZ_ASSERT(!mTabParents.Contains(aTabParent));
- mTabParents.AppendElement(aTabParent);
-}
-
-void
-AudioChannelService::UnregisterTabParent(TabParent* aTabParent)
-{
- MOZ_ASSERT(aTabParent);
- mTabParents.RemoveElement(aTabParent);
}
AudioPlaybackConfig
AudioChannelService::GetMediaConfig(nsPIDOMWindowOuter* aWindow,
uint32_t aAudioChannel) const
{
MOZ_ASSERT(!aWindow || aWindow->IsOuterWindow());
MOZ_ASSERT(aAudioChannel < NUMBER_OF_AUDIO_CHANNELS);
@@ -491,120 +438,16 @@ AudioChannelService::AudioAudibleChanged
uint64_t windowID = aAgent->WindowID();
AudioChannelWindow* winData = GetWindowData(windowID);
if (winData) {
winData->AudioAudibleChanged(aAgent, aAudible, aReason);
}
}
-bool
-AudioChannelService::TelephonyChannelIsActive()
-{
- nsTObserverArray<nsAutoPtr<AudioChannelWindow>>::ForwardIterator windowsIter(mWindows);
- while (windowsIter.HasMore()) {
- AudioChannelWindow* next = windowsIter.GetNext();
- if (next->mChannels[(uint32_t)AudioChannel::Telephony].mNumberOfAgents != 0 &&
- !next->mChannels[(uint32_t)AudioChannel::Telephony].mMuted) {
- return true;
- }
- }
-
- if (IsParentProcess()) {
- nsTObserverArray<nsAutoPtr<AudioChannelChildStatus>>::ForwardIterator
- childrenIter(mPlayingChildren);
- while (childrenIter.HasMore()) {
- AudioChannelChildStatus* child = childrenIter.GetNext();
- if (child->mActiveTelephonyChannel) {
- return true;
- }
- }
- }
-
- return false;
-}
-
-bool
-AudioChannelService::ContentOrNormalChannelIsActive()
-{
- // This method is meant to be used just by the child to send status update.
- MOZ_ASSERT(!IsParentProcess());
-
- nsTObserverArray<nsAutoPtr<AudioChannelWindow>>::ForwardIterator iter(mWindows);
- while (iter.HasMore()) {
- AudioChannelWindow* next = iter.GetNext();
- if (next->mChannels[(uint32_t)AudioChannel::Content].mNumberOfAgents > 0 ||
- next->mChannels[(uint32_t)AudioChannel::Normal].mNumberOfAgents > 0) {
- return true;
- }
- }
- return false;
-}
-
-AudioChannelService::AudioChannelChildStatus*
-AudioChannelService::GetChildStatus(uint64_t aChildID) const
-{
- nsTObserverArray<nsAutoPtr<AudioChannelChildStatus>>::ForwardIterator
- iter(mPlayingChildren);
- while (iter.HasMore()) {
- AudioChannelChildStatus* child = iter.GetNext();
- if (child->mChildID == aChildID) {
- return child;
- }
- }
-
- return nullptr;
-}
-
-void
-AudioChannelService::RemoveChildStatus(uint64_t aChildID)
-{
- nsTObserverArray<nsAutoPtr<AudioChannelChildStatus>>::ForwardIterator
- iter(mPlayingChildren);
- while (iter.HasMore()) {
- nsAutoPtr<AudioChannelChildStatus>& child = iter.GetNext();
- if (child->mChildID == aChildID) {
- mPlayingChildren.RemoveElement(child);
- break;
- }
- }
-}
-
-bool
-AudioChannelService::ProcessContentOrNormalChannelIsActive(uint64_t aChildID)
-{
- AudioChannelChildStatus* child = GetChildStatus(aChildID);
- if (!child) {
- return false;
- }
-
- return child->mActiveContentOrNormalChannel;
-}
-
-bool
-AudioChannelService::AnyAudioChannelIsActive()
-{
- nsTObserverArray<nsAutoPtr<AudioChannelWindow>>::ForwardIterator iter(mWindows);
- while (iter.HasMore()) {
- AudioChannelWindow* next = iter.GetNext();
- for (uint32_t i = 0; kMozAudioChannelAttributeTable[i].tag; ++i) {
- if (next->mChannels[kMozAudioChannelAttributeTable[i].value].mNumberOfAgents
- != 0) {
- return true;
- }
- }
- }
-
- if (IsParentProcess()) {
- return !mPlayingChildren.IsEmpty();
- }
-
- return false;
-}
-
NS_IMETHODIMP
AudioChannelService::Observe(nsISupports* aSubject, const char* aTopic,
const char16_t* aData)
{
if (!strcmp(aTopic, "xpcom-shutdown")) {
sXPCOMShuttingDown = true;
Shutdown();
} else if (!strcmp(aTopic, "outer-window-destroyed")) {
@@ -634,37 +477,16 @@ AudioChannelService::Observe(nsISupports
if (winData) {
nsTObserverArray<AudioChannelAgent*>::ForwardIterator
iter(winData->mAgents);
while (iter.HasMore()) {
iter.GetNext()->WindowVolumeChanged();
}
}
-
- } else if (!strcmp(aTopic, "ipc:content-shutdown")) {
- nsCOMPtr<nsIPropertyBag2> props = do_QueryInterface(aSubject);
- if (!props) {
- NS_WARNING("ipc:content-shutdown message without property bag as subject");
- return NS_OK;
- }
-
- uint64_t childID = 0;
- nsresult rv = props->GetPropertyAsUint64(NS_LITERAL_STRING("childID"),
- &childID);
- if (NS_WARN_IF(NS_FAILED(rv))) {
- return rv;
- }
-
- if (mDefChannelChildID == childID) {
- SetDefaultVolumeControlChannelInternal(-1, false, childID);
- mDefChannelChildID = CONTENT_PROCESS_ID_UNKNOWN;
- }
-
- RemoveChildStatus(childID);
}
return NS_OK;
}
void
AudioChannelService::RefreshAgents(nsPIDOMWindowOuter* aWindow,
const std::function<void(AudioChannelAgent*)>& aFunc)
@@ -775,47 +597,16 @@ AudioChannelService::GetDefaultAudioChan
if (audioChannel.EqualsASCII(kMozAudioChannelAttributeTable[i].tag)) {
return static_cast<AudioChannel>(kMozAudioChannelAttributeTable[i].value);
}
}
return AudioChannel::Normal;
}
-/* static */ void
-AudioChannelService::GetAudioChannelString(AudioChannel aChannel,
- nsAString& aString)
-{
- aString.AssignASCII("normal");
-
- for (uint32_t i = 0; kMozAudioChannelAttributeTable[i].tag; ++i) {
- if (aChannel ==
- static_cast<AudioChannel>(kMozAudioChannelAttributeTable[i].value)) {
- aString.AssignASCII(kMozAudioChannelAttributeTable[i].tag);
- break;
- }
- }
-}
-
-/* static */ void
-AudioChannelService::GetDefaultAudioChannelString(nsAString& aString)
-{
- aString.AssignASCII("normal");
-
- nsAutoString audioChannel(Preferences::GetString("media.defaultAudioChannel"));
- if (!audioChannel.IsEmpty()) {
- for (uint32_t i = 0; kMozAudioChannelAttributeTable[i].tag; ++i) {
- if (audioChannel.EqualsASCII(kMozAudioChannelAttributeTable[i].tag)) {
- aString = audioChannel;
- break;
- }
- }
- }
-}
-
AudioChannelService::AudioChannelWindow*
AudioChannelService::GetOrCreateWindowData(nsPIDOMWindowOuter* aWindow)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aWindow);
MOZ_ASSERT(aWindow->IsOuterWindow());
AudioChannelWindow* winData = GetWindowData(aWindow->WindowID());
@@ -851,125 +642,16 @@ AudioChannelService::IsWindowActive(nsPI
if (!window) {
return false;
}
AudioChannelWindow* winData = GetOrCreateWindowData(window);
return !winData->mAudibleAgents.IsEmpty();
}
void
-AudioChannelService::SetDefaultVolumeControlChannel(int32_t aChannel,
- bool aVisible)
-{
- SetDefaultVolumeControlChannelInternal(aChannel, aVisible,
- CONTENT_PROCESS_ID_MAIN);
-}
-
-void
-AudioChannelService::SetDefaultVolumeControlChannelInternal(int32_t aChannel,
- bool aVisible,
- uint64_t aChildID)
-{
- if (!IsParentProcess()) {
- ContentChild* cc = ContentChild::GetSingleton();
- if (cc) {
- cc->SendAudioChannelChangeDefVolChannel(aChannel, aVisible);
- }
-
- return;
- }
-
- // If this child is in the background and mDefChannelChildID is set to
- // others then it means other child in the foreground already set it's
- // own default channel.
- if (!aVisible && mDefChannelChildID != aChildID) {
- return;
- }
-
- // Workaround for the call screen app. The call screen app is running on the
- // main process, that will results in wrong visible state. Because we use the
- // docshell's active state as visible state, the main process is always
- // active. Therefore, we will see the strange situation that the visible
- // state of the call screen is always true. If the mDefChannelChildID is set
- // to others then it means other child in the foreground already set it's
- // own default channel already.
- // Summary :
- // Child process : foreground app always can set type.
- // Parent process : check the mDefChannelChildID.
- else if (aChildID == CONTENT_PROCESS_ID_MAIN &&
- mDefChannelChildID != CONTENT_PROCESS_ID_UNKNOWN) {
- return;
- }
-
- mDefChannelChildID = aVisible ? aChildID : CONTENT_PROCESS_ID_UNKNOWN;
- nsAutoString channelName;
-
- if (aChannel == -1) {
- channelName.AssignASCII("unknown");
- } else {
- GetAudioChannelString(static_cast<AudioChannel>(aChannel), channelName);
- }
-
- nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
- if (obs) {
- obs->NotifyObservers(nullptr, "default-volume-channel-changed",
- channelName.get());
- }
-}
-
-void
-AudioChannelService::MaybeSendStatusUpdate()
-{
- if (IsParentProcess()) {
- return;
- }
-
- bool telephonyChannel = TelephonyChannelIsActive();
- bool contentOrNormalChannel = ContentOrNormalChannelIsActive();
- bool anyChannel = AnyAudioChannelIsActive();
-
- if (telephonyChannel == mTelephonyChannel &&
- contentOrNormalChannel == mContentOrNormalChannel &&
- anyChannel == mAnyChannel) {
- return;
- }
-
- mTelephonyChannel = telephonyChannel;
- mContentOrNormalChannel = contentOrNormalChannel;
- mAnyChannel = anyChannel;
-
- ContentChild* cc = ContentChild::GetSingleton();
- if (cc) {
- cc->SendAudioChannelServiceStatus(telephonyChannel, contentOrNormalChannel,
- anyChannel);
- }
-}
-
-void
-AudioChannelService::ChildStatusReceived(uint64_t aChildID,
- bool aTelephonyChannel,
- bool aContentOrNormalChannel,
- bool aAnyChannel)
-{
- if (!aAnyChannel) {
- RemoveChildStatus(aChildID);
- return;
- }
-
- AudioChannelChildStatus* data = GetChildStatus(aChildID);
- if (!data) {
- data = new AudioChannelChildStatus(aChildID);
- mPlayingChildren.AppendElement(data);
- }
-
- data->mActiveTelephonyChannel = aTelephonyChannel;
- data->mActiveContentOrNormalChannel = aContentOrNormalChannel;
-}
-
-void
AudioChannelService::RefreshAgentsAudioFocusChanged(AudioChannelAgent* aAgent)
{
MOZ_ASSERT(aAgent);
nsTObserverArray<nsAutoPtr<AudioChannelWindow>>::ForwardIterator
iter(mWindows);
while (iter.HasMore()) {
AudioChannelWindow* winData = iter.GetNext();
@@ -1160,23 +842,16 @@ AudioChannelService::AudioChannelWindow:
("AudioChannelWindow, GetCompetingBehavior, this = %p, "
"present type = %d, incoming channel = %d, behavior = %s\n",
this, presentChannelType, aIncomingChannelType,
SuspendTypeToStr(competingBehavior)));
return competingBehavior;
}
-/* static */ bool
-AudioChannelService::IsAudioChannelMutedByDefault()
-{
- CreateServiceIfNeeded();
- return sAudioChannelMutedByDefault;
-}
-
void
AudioChannelService::AudioChannelWindow::AppendAgent(AudioChannelAgent* aAgent,
AudibleState aAudible)
{
MOZ_ASSERT(aAgent);
RequestAudioFocus(aAgent);
AppendAgentAndIncreaseAgentsNum(aAgent);
@@ -1229,40 +904,36 @@ AudioChannelService::AudioChannelWindow:
MOZ_ASSERT(aAgent);
MOZ_ASSERT(!mAgents.Contains(aAgent));
int32_t channel = aAgent->AudioChannelType();
mAgents.AppendElement(aAgent);
++mChannels[channel].mNumberOfAgents;
- // The first one, we must inform the BrowserElementAudioChannel.
+ // TODO: Make NotifyChannelActiveRunnable irrelevant to BrowserElementAudioChannel
if (mChannels[channel].mNumberOfAgents == 1) {
- NotifyChannelActive(aAgent->WindowID(),
- static_cast<AudioChannel>(channel),
- true);
+ NotifyChannelActive(aAgent->WindowID(), true);
}
}
void
AudioChannelService::AudioChannelWindow::RemoveAgentAndReduceAgentsNum(AudioChannelAgent* aAgent)
{
MOZ_ASSERT(aAgent);
MOZ_ASSERT(mAgents.Contains(aAgent));
int32_t channel = aAgent->AudioChannelType();
mAgents.RemoveElement(aAgent);
MOZ_ASSERT(mChannels[channel].mNumberOfAgents > 0);
--mChannels[channel].mNumberOfAgents;
if (mChannels[channel].mNumberOfAgents == 0) {
- NotifyChannelActive(aAgent->WindowID(),
- static_cast<AudioChannel>(channel),
- false);
+ NotifyChannelActive(aAgent->WindowID(), false);
}
}
void
AudioChannelService::AudioChannelWindow::AudioCapturedChanged(AudioChannelAgent* aAgent,
AudioCaptureState aCapture)
{
MOZ_ASSERT(aAgent);
@@ -1349,21 +1020,20 @@ AudioChannelService::AudioChannelWindow:
aAudible == AudibleState::eAudible,
aReason);
DebugOnly<nsresult> rv = NS_DispatchToCurrentThread(runnable);
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "NS_DispatchToCurrentThread failed");
}
void
AudioChannelService::AudioChannelWindow::NotifyChannelActive(uint64_t aWindowID,
- AudioChannel aChannel,
bool aActive)
{
RefPtr<NotifyChannelActiveRunnable> runnable =
- new NotifyChannelActiveRunnable(aWindowID, aChannel, aActive);
+ new NotifyChannelActiveRunnable(aWindowID, aActive);
DebugOnly<nsresult> rv = NS_DispatchToCurrentThread(runnable);
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "NS_DispatchToCurrentThread failed");
}
void
AudioChannelService::AudioChannelWindow::MaybeNotifyMediaBlockStart(AudioChannelAgent* aAgent)
{
nsCOMPtr<nsPIDOMWindowOuter> window = aAgent->Window();
--- a/dom/audiochannel/AudioChannelService.h
+++ b/dom/audiochannel/AudioChannelService.h
@@ -14,25 +14,22 @@
#include "AudioChannelAgent.h"
#include "nsAttrValue.h"
#include "mozilla/dom/AudioChannelBinding.h"
#include "mozilla/Logging.h"
#include <functional>
-class nsIRunnable;
class nsPIDOMWindowOuter;
struct PRLogModuleInfo;
namespace mozilla {
namespace dom {
-class TabParent;
-
#define NUMBER_OF_AUDIO_CHANNELS (uint32_t)AudioChannel::EndGuard_
class AudioPlaybackConfig
{
public:
AudioPlaybackConfig()
: mVolume(1.0)
, mMuted(false)
@@ -93,18 +90,16 @@ public:
static already_AddRefed<AudioChannelService> GetOrCreate();
/**
* Returns the AudioChannelService singleton if one exists.
* If AudioChannelService doesn't exist, returns null.
*/
static already_AddRefed<AudioChannelService> Get();
- static bool IsAudioChannelMutedByDefault();
-
static LogModule* GetAudioChannelLog();
static bool IsEnableAudioCompeting();
/**
* Any audio channel agent that starts playing should register itself to
* this service, sharing the AudioChannel.
*/
@@ -113,22 +108,16 @@ public:
/**
* Any audio channel agent that stops playing should unregister itself to
* this service.
*/
void UnregisterAudioChannelAgent(AudioChannelAgent* aAgent);
/**
- * For nested iframes.
- */
- void RegisterTabParent(TabParent* aTabParent);
- void UnregisterTabParent(TabParent* aTabParent);
-
- /**
* Return the state to indicate this audioChannel for his window should keep
* playing/muted/suspended.
*/
AudioPlaybackConfig GetMediaConfig(nsPIDOMWindowOuter* aWindow,
uint32_t aAudioChannel) const;
/**
* Called this method when the audible state of the audio playback changed,
@@ -136,61 +125,31 @@ public:
* actual audible state of the window.
*/
void AudioAudibleChanged(AudioChannelAgent* aAgent,
AudibleState aAudible,
AudibleChangedReasons aReason);
bool IsWindowActive(nsPIDOMWindowOuter* aWindow);
- /**
- * Return true if there is a telephony channel active in this process
- * or one of its subprocesses.
- */
- bool TelephonyChannelIsActive();
-
- /**
- * Return true if a normal or content channel is active for the given
- * process ID.
- */
- bool ProcessContentOrNormalChannelIsActive(uint64_t aChildID);
-
- /***
- * AudioChannelManager calls this function to notify the default channel used
- * to adjust volume when there is no any active channel. if aChannel is -1,
- * the default audio channel will be used. Otherwise aChannel is casted to
- * AudioChannel enum.
- */
- virtual void SetDefaultVolumeControlChannel(int32_t aChannel,
- bool aVisible);
-
- bool AnyAudioChannelIsActive();
-
void RefreshAgentsVolume(nsPIDOMWindowOuter* aWindow);
void RefreshAgentsSuspend(nsPIDOMWindowOuter* aWindow,
nsSuspendedTypes aSuspend);
// This method needs to know the inner window that wants to capture audio. We
// group agents per top outer window, but we can have multiple innerWindow per
// top outerWindow (subiframes, etc.) and we have to identify all the agents
// just for a particular innerWindow.
void SetWindowAudioCaptured(nsPIDOMWindowOuter* aWindow,
uint64_t aInnerWindowID,
bool aCapture);
static const nsAttrValue::EnumTable* GetAudioChannelTable();
static AudioChannel GetAudioChannel(const nsAString& aString);
static AudioChannel GetDefaultAudioChannel();
- static void GetAudioChannelString(AudioChannel aChannel, nsAString& aString);
- static void GetDefaultAudioChannelString(nsAString& aString);
-
- void Notify(uint64_t aWindowID);
-
- void ChildStatusReceived(uint64_t aChildID, bool aTelephonyChannel,
- bool aContentOrNormalChannel, bool aAnyChannel);
void NotifyCreatedNewAgent(AudioChannelAgent* aAgent);
void NotifyMediaResumedFromBlock(nsPIDOMWindowOuter* aWindow);
private:
AudioChannelService();
~AudioChannelService();
@@ -200,32 +159,23 @@ private:
static void CreateServiceIfNeeded();
/**
* Shutdown the singleton.
*/
static void Shutdown();
- void MaybeSendStatusUpdate();
-
- bool ContentOrNormalChannelIsActive();
-
- /* Send the default-volume-channel-changed notification */
- void SetDefaultVolumeControlChannelInternal(int32_t aChannel,
- bool aVisible, uint64_t aChildID);
-
void RefreshAgentsAudioFocusChanged(AudioChannelAgent* aAgent);
class AudioChannelConfig final : public AudioPlaybackConfig
{
public:
AudioChannelConfig()
- : AudioPlaybackConfig(1.0, IsAudioChannelMutedByDefault(),
- nsISuspendedTypes::NONE_SUSPENDED)
+ : AudioPlaybackConfig(1.0, false, nsISuspendedTypes::NONE_SUSPENDED)
, mNumberOfAgents(0)
{}
uint32_t mNumberOfAgents;
};
class AudioChannelWindow final
{
@@ -276,18 +226,17 @@ private:
bool IsFirstAudibleAgent() const;
bool IsLastAudibleAgent() const;
void NotifyAudioAudibleChanged(nsPIDOMWindowOuter* aWindow,
AudibleState aAudible,
AudibleChangedReasons aReason);
- void NotifyChannelActive(uint64_t aWindowID, AudioChannel aChannel,
- bool aActive);
+ void NotifyChannelActive(uint64_t aWindowID, bool aActive);
void MaybeNotifyMediaBlockStart(AudioChannelAgent* aAgent);
void RequestAudioFocus(AudioChannelAgent* aAgent);
// We need to do audio competing only when the new incoming agent started.
void NotifyAudioCompetingChanged(AudioChannelAgent* aAgent);
uint32_t GetCompetingBehavior(AudioChannelAgent* aAgent,
@@ -300,56 +249,17 @@ private:
};
AudioChannelWindow*
GetOrCreateWindowData(nsPIDOMWindowOuter* aWindow);
AudioChannelWindow*
GetWindowData(uint64_t aWindowID) const;
- struct AudioChannelChildStatus final
- {
- explicit AudioChannelChildStatus(uint64_t aChildID)
- : mChildID(aChildID)
- , mActiveTelephonyChannel(false)
- , mActiveContentOrNormalChannel(false)
- {}
-
- uint64_t mChildID;
- bool mActiveTelephonyChannel;
- bool mActiveContentOrNormalChannel;
- };
-
- AudioChannelChildStatus*
- GetChildStatus(uint64_t aChildID) const;
-
- void
- RemoveChildStatus(uint64_t aChildID);
-
nsTObserverArray<nsAutoPtr<AudioChannelWindow>> mWindows;
-
- nsTObserverArray<nsAutoPtr<AudioChannelChildStatus>> mPlayingChildren;
-
- // Raw pointers because TabParents must unregister themselves.
- nsTArray<TabParent*> mTabParents;
-
- nsCOMPtr<nsIRunnable> mRunnable;
-
- uint64_t mDefChannelChildID;
-
- // These boolean are used to know if we have to send an status update to the
- // service running in the main process.
- bool mTelephonyChannel;
- bool mContentOrNormalChannel;
- bool mAnyChannel;
-
- // This is needed for IPC comunication between
- // AudioChannelServiceChild and this class.
- friend class ContentParent;
- friend class ContentChild;
};
const char* SuspendTypeToStr(const nsSuspendedTypes& aSuspend);
const char* AudibleStateToStr(const AudioChannelService::AudibleState& aAudible);
const char* AudibleChangedReasonToStr(const AudioChannelService::AudibleChangedReasons& aReason);
} // namespace dom
} // namespace mozilla
--- a/dom/browser-element/mochitest/chrome.ini
+++ b/dom/browser-element/mochitest/chrome.ini
@@ -20,17 +20,16 @@ support-files =
browserElement_PurgeHistory.js
browserElement_ReloadPostRequest.js
browserElement_SendEvent.js
browserElement_SetVisible.js
browserElement_SetVisibleFrames.js
browserElement_SetVisibleFrames2.js
browserElement_Stop.js
browserElement_VisibilityChange.js
- file_audio.html
file_browserElement_ExecuteScript.html
file_browserElement_NextPaint.html
file_browserElement_SendEvent.html
file_browserElement_SetVisibleFrames2_Outer.html
file_browserElement_SetVisibleFrames_Inner.html
file_browserElement_SetVisibleFrames_Outer.html
file_bug709759.sjs
file_empty.html
deleted file mode 100644
--- a/dom/browser-element/mochitest/file_audio.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<html>
-<body>
-<audio src="chrome://mochitests/content/chrome/dom/browser-element/mochitest/audio.ogg" id="audio" />
-<script>
-var audio = document.getElementById('audio');
-audio.play();
-audio.onended = function() {
- setTimeout(function() {
- audio.play();
- }, 0);
-}
-</script>
-
-</body>
-</html>
--- a/dom/browser-element/mochitest/mochitest.ini
+++ b/dom/browser-element/mochitest/mochitest.ini
@@ -84,17 +84,16 @@ support-files =
file_bug741717.sjs
file_download_bin.sjs
file_empty.html
file_empty_script.js
file_focus.html
file_http_401_response.sjs
file_http_407_response.sjs
file_wyciwyg.html
- file_audio.html
file_web_manifest.html
file_web_manifest.json
file_illegal_web_manifest.html
noaudio.webm
# Note: browserElementTestHelpers.js looks at the test's filename to determine
# whether the test should be OOP. "_oop_" signals OOP, "_inproc_" signals in
# process. Default is OOP.
--- a/dom/browser-element/mochitest/priority/chrome.ini
+++ b/dom/browser-element/mochitest/priority/chrome.ini
@@ -1,18 +1,16 @@
[DEFAULT]
# Good luck running these tests on anything but desktop Linux.
run-if = os == 'linux' && buildapp == 'browser' && !e10s
support-files =
- file_Audio.html
file_MultipleFrames.html
file_NestedFramesOuter.html
file_WebGLContextLost.html
silence.ogg
!/dom/browser-element/mochitest/browserElementTestHelpers.js
!/dom/browser-element/mochitest/file_empty.html
[test_Activity.html]
-[test_Audio.html]
[test_Background.html]
[test_MultipleFrames.html]
[test_NestedFrames.html]
[test_Visibility.html]
deleted file mode 100644
--- a/dom/browser-element/mochitest/priority/file_Audio.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<html>
-<body>
-
-<script>
-addEventListener('load', function() {
- setTimeout(function() {
- var a = document.getElementById('audio');
- a.onplay = function() {
- alert('onplay');
- };
- a.play();
- }, 0);
-});
-</script>
-
-<audio id='audio' loop src='silence.ogg'>
-
-</body>
-</html>
deleted file mode 100644
--- a/dom/browser-element/mochitest/priority/test_Audio.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-Test that frames playing audio get BACKGROUND_PERCEIVABLE priority.
--->
-<head>
- <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <script type="application/javascript" src="../browserElementTestHelpers.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
-</head>
-<body>
-
-<script type="application/javascript">
-"use strict";
-
-SimpleTest.waitForExplicitFinish();
-browserElementTestHelpers.setEnabledPref(true);
-browserElementTestHelpers.enableProcessPriorityManager();
-
-function runTest() {
- var iframe = document.createElement('iframe');
- iframe.setAttribute('mozbrowser', true);
- iframe.src = 'file_Audio.html';
-
- var childID = null;
- Promise.all([
- expectOnlyOneProcessCreated("FOREGROUND").then(function(chid) {
- childID = chid;
- }),
- expectMozbrowserEvent(iframe, 'loadend'),
- expectMozbrowserEvent(iframe, 'showmodalprompt').then(function(e) {
- is(e.detail.message, 'onplay', 'showmodalprompt message');
- })
- ]).then(function() {
- // Send the child process into the background. Because it's playing audio,
- // it should get priority BACKGROUND_PERCEIVABLE, not vanilla BACKGROUND.
- var p = expectPriorityChange(childID, 'BACKGROUND_PERCEIVABLE');
- iframe.setVisible(false);
- return p;
- }).then(function() {
- var p = expectPriorityChange(childID, 'FOREGROUND');
- iframe.setVisible(true);
- return p;
- }).then(SimpleTest.finish);
-
- document.body.appendChild(iframe);
-}
-
-addEventListener('testready', runTest);
-
-</script>
-</body>
-</html>
--- a/dom/canvas/test/reftest/reftest.list
+++ b/dom/canvas/test/reftest/reftest.list
@@ -1,10 +1,10 @@
# WebGL Reftests!
-default-preferences pref(webgl.force-enabled,true) pref(media.useAudioChannelAPI,true) pref(dom.audiochannel.mutedByDefault,false)
+default-preferences pref(webgl.force-enabled,true) pref(media.useAudioChannelAPI,true)
# Check that disabling works:
skip-if(Android) == webgl-disable-test.html?nogl wrapper.html?green.png
pref(webgl.disabled,true) skip-if(Android) == webgl-disable-test.html wrapper.html?green.png
# Basic WebGL tests:
# Do we get pixels to the screen at all?
# Neither of these should ever break.
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -19,17 +19,16 @@
#ifdef MOZ_WIDGET_GONK
#include <sys/types.h>
#include <sys/wait.h>
#endif
#include "chrome/common/process_watcher.h"
#include "mozilla/a11y/PDocAccessible.h"
-#include "AudioChannelService.h"
#ifdef MOZ_GECKO_PROFILER
#include "CrossProcessProfilerController.h"
#endif
#include "GeckoProfiler.h"
#include "GMPServiceParent.h"
#include "HandlerServiceParent.h"
#include "IHistory.h"
#include "imgIContainer.h"
@@ -2647,40 +2646,16 @@ ContentParent::RecvFirstIdle()
// When the ContentChild goes idle, it sends us a FirstIdle message
// which we use as a good time to prelaunch another process. If we
// prelaunch any sooner than this, then we'll be competing with the
// child process and slowing it down.
PreallocatedProcessManager::AllocateAfterDelay();
return IPC_OK();
}
-mozilla::ipc::IPCResult
-ContentParent::RecvAudioChannelChangeDefVolChannel(const int32_t& aChannel,
- const bool& aHidden)
-{
- RefPtr<AudioChannelService> service = AudioChannelService::GetOrCreate();
- MOZ_ASSERT(service);
- service->SetDefaultVolumeControlChannelInternal(aChannel, aHidden, mChildID);
- return IPC_OK();
-}
-
-mozilla::ipc::IPCResult
-ContentParent::RecvAudioChannelServiceStatus(
- const bool& aTelephonyChannel,
- const bool& aContentOrNormalChannel,
- const bool& aAnyChannel)
-{
- RefPtr<AudioChannelService> service = AudioChannelService::GetOrCreate();
- MOZ_ASSERT(service);
-
- service->ChildStatusReceived(mChildID, aTelephonyChannel,
- aContentOrNormalChannel, aAnyChannel);
- return IPC_OK();
-}
-
// We want ContentParent to show up in CC logs for debugging purposes, but we
// don't actually cycle collect it.
NS_IMPL_CYCLE_COLLECTION_0(ContentParent)
NS_IMPL_CYCLE_COLLECTING_ADDREF(ContentParent)
NS_IMPL_CYCLE_COLLECTING_RELEASE(ContentParent)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ContentParent)
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -1063,23 +1063,16 @@ private:
const uint32_t& aColNumber,
const uint32_t& aFlags,
const nsCString& aCategory) override;
virtual mozilla::ipc::IPCResult RecvPrivateDocShellsExist(const bool& aExist) override;
virtual mozilla::ipc::IPCResult RecvFirstIdle() override;
- virtual mozilla::ipc::IPCResult RecvAudioChannelChangeDefVolChannel(const int32_t& aChannel,
- const bool& aHidden) override;
-
- virtual mozilla::ipc::IPCResult RecvAudioChannelServiceStatus(const bool& aTelephonyChannel,
- const bool& aContentOrNormalChannel,
- const bool& aAnyChannel) override;
-
virtual mozilla::ipc::IPCResult RecvKeywordToURI(const nsCString& aKeyword,
nsString* aProviderName,
OptionalIPCStream* aPostData,
OptionalURIParams* aURI) override;
virtual mozilla::ipc::IPCResult RecvNotifyKeywordSearchLoading(const nsString &aProvider,
const nsString &aKeyword) override;
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -587,19 +587,16 @@ parent:
nested(inside_sync) sync DispatchMouseEvent(WidgetMouseEvent event);
nested(inside_sync) sync DispatchKeyboardEvent(WidgetKeyboardEvent event);
async InvokeDragSession(IPCDataTransfer[] transfers, uint32_t action,
OptionalShmem visualData,
uint32_t stride, uint8_t format,
LayoutDeviceIntRect dragRect);
- async AudioChannelActivityNotification(uint32_t aAudioChannel,
- bool aActive);
-
// After a compositor reset, it is necessary to reconnect each layers ID to
// the compositor of the widget that will render those layers. Note that
// this is sync so we can ensure that messages to the window compositor
// arrive before the TabChild attempts to use its cross-process compositor
// bridge.
sync EnsureLayersConnected() returns (CompositorOptions compositorOptions);
/**
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -849,22 +849,16 @@ parent:
returns (bool showPassword);
// Notify the parent of the presence or absence of private docshells
async PrivateDocShellsExist(bool aExist);
// Tell the parent that the child has gone idle for the first time.
async FirstIdle();
- async AudioChannelServiceStatus(bool aActiveTelephonyChannel,
- bool aContentOrNormalChannel,
- bool aAnyActiveChannel);
-
- async AudioChannelChangeDefVolChannel(int32_t aChannel, bool aHidden);
-
sync KeywordToURI(nsCString keyword)
returns (nsString providerName, OptionalIPCStream postData, OptionalURIParams uri);
sync NotifyKeywordSearchLoading(nsString providerName, nsString keyword);
async CopyFavicon(URIParams oldURI, URIParams newURI, Principal aLoadingPrincipal, bool isPrivate);
// Tell the compositor to allocate a layer tree id for nested remote mozbrowsers.
--- a/dom/ipc/ProcessPriorityManager.cpp
+++ b/dom/ipc/ProcessPriorityManager.cpp
@@ -9,17 +9,16 @@
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/Hal.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
#include "mozilla/Unused.h"
-#include "AudioChannelService.h"
#include "mozilla/Logging.h"
#include "nsPrintfCString.h"
#include "nsXULAppAPI.h"
#include "nsIFrameLoader.h"
#include "nsIObserverService.h"
#include "StaticPtr.h"
#include "nsIMozBrowserFrame.h"
#include "nsIObserver.h"
@@ -1039,21 +1038,16 @@ ParticularProcessPriorityManager::Comput
return PROCESS_PRIORITY_FOREGROUND;
}
if ((mHoldsCPUWakeLock || mHoldsHighPriorityWakeLock) &&
IsExpectingSystemMessage()) {
return PROCESS_PRIORITY_BACKGROUND_PERCEIVABLE;
}
- RefPtr<AudioChannelService> service = AudioChannelService::GetOrCreate();
- if (service && service->ProcessContentOrNormalChannelIsActive(ChildID())) {
- return PROCESS_PRIORITY_BACKGROUND_PERCEIVABLE;
- }
-
return mIsActivityOpener ? PROCESS_PRIORITY_BACKGROUND_PERCEIVABLE
: PROCESS_PRIORITY_BACKGROUND;
}
void
ParticularProcessPriorityManager::SetPriorityNow(ProcessPriority aPriority,
uint32_t aLRU)
{
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -417,36 +417,16 @@ TabChild::TabChild(nsIContentChild* aMan
}
};
// preloaded TabChild should not be added to child map
if (mUniqueId) {
MOZ_ASSERT(NestedTabChildMap().find(mUniqueId) == NestedTabChildMap().end());
NestedTabChildMap()[mUniqueId] = this;
}
-
- nsCOMPtr<nsIObserverService> observerService =
- mozilla::services::GetObserverService();
-
- if (observerService) {
- const nsAttrValue::EnumTable* table =
- AudioChannelService::GetAudioChannelTable();
-
- nsAutoCString topic;
- for (uint32_t i = 0; table[i].tag; ++i) {
- topic.Assign("audiochannel-activity-");
- topic.Append(table[i].tag);
-
- observerService->AddObserver(this, topic.get(), false);
- }
- }
-
- for (uint32_t idx = 0; idx < NUMBER_OF_AUDIO_CHANNELS; idx++) {
- mAudioChannelsActive.AppendElement(false);
- }
}
bool
TabChild::AsyncPanZoomEnabled() const
{
// By the time anybody calls this, we must have had InitRenderingState called
// already, and so mCompositorOptions should be populated.
MOZ_RELEASE_ASSERT(mCompositorOptions);
@@ -469,69 +449,16 @@ TabChild::Observe(nsISupports *aSubject,
shell->SetIsFirstPaint(true);
}
APZCCallbackHelper::InitializeRootDisplayport(shell);
}
}
}
- const nsAttrValue::EnumTable* table =
- AudioChannelService::GetAudioChannelTable();
-
- nsAutoCString topic;
- int16_t audioChannel = -1;
- for (uint32_t i = 0; table[i].tag; ++i) {
- topic.Assign("audiochannel-activity-");
- topic.Append(table[i].tag);
-
- if (topic.Equals(aTopic)) {
- audioChannel = table[i].value;
- break;
- }
- }
-
- if (audioChannel != -1 && mIPCOpen) {
- // If the subject is not a wrapper, it is sent by the TabParent and we
- // should ignore it.
- nsCOMPtr<nsISupportsPRUint64> wrapper = do_QueryInterface(aSubject);
- if (!wrapper) {
- return NS_OK;
- }
-
- // We must have a window in order to compare the windowID contained into the
- // wrapper.
- nsCOMPtr<nsPIDOMWindowOuter> window = do_GetInterface(WebNavigation());
- if (!window) {
- return NS_OK;
- }
-
- uint64_t windowID = 0;
- nsresult rv = wrapper->GetData(&windowID);
- if (NS_WARN_IF(NS_FAILED(rv))) {
- return rv;
- }
-
- // In theory a tabChild should contain just 1 top window, but let's double
- // check it comparing the windowID.
- if (window->WindowID() != windowID) {
- MOZ_LOG(AudioChannelService::GetAudioChannelLog(), LogLevel::Debug,
- ("TabChild, Observe, different windowID, owner ID = %" PRIu64 ", "
- "ID from wrapper = %" PRIu64, window->WindowID(), windowID));
- return NS_OK;
- }
-
- nsAutoString activeStr(aData);
- bool active = activeStr.EqualsLiteral("active");
- if (active != mAudioChannelsActive[audioChannel]) {
- mAudioChannelsActive[audioChannel] = active;
- Unused << SendAudioChannelActivityNotification(audioChannel, active);
- }
- }
-
return NS_OK;
}
void
TabChild::ContentReceivedInputBlock(const ScrollableLayerGuid& aGuid,
uint64_t aInputBlockId,
bool aPreventDefault) const
{
@@ -2425,27 +2352,16 @@ TabChild::RecvDestroy()
mTabChildGlobal->DispatchTrustedEvent(NS_LITERAL_STRING("unload"));
}
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
observerService->RemoveObserver(this, BEFORE_FIRST_PAINT);
- const nsAttrValue::EnumTable* table =
- AudioChannelService::GetAudioChannelTable();
-
- nsAutoCString topic;
- for (uint32_t i = 0; table[i].tag; ++i) {
- topic.Assign("audiochannel-activity-");
- topic.Append(table[i].tag);
-
- observerService->RemoveObserver(this, topic.get());
- }
-
// XXX what other code in ~TabChild() should we be running here?
DestroyWindow();
// Bounce through the event loop once to allow any delayed teardown runnables
// that were just generated to have a chance to run.
nsCOMPtr<nsIRunnable> deleteRunnable = new DelayedDeleteRunnable(this);
MOZ_ALWAYS_SUCCEEDS(NS_DispatchToCurrentThread(deleteRunnable));
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -836,18 +836,16 @@ private:
// Similar to mRepeatedKeyEventTime, store the end time (from parent process)
// of handling the last repeated wheel event so that in case event handling
// takes time, some repeated events can be skipped to not flood child process.
mozilla::TimeStamp mLastWheelProcessedTimeFromParent;
mozilla::TimeDuration mLastWheelProcessingDuration;
CoalescedWheelData mCoalescedWheelData;
- AutoTArray<bool, NUMBER_OF_AUDIO_CHANNELS> mAudioChannelsActive;
-
RefPtr<layers::IAPZCTreeManager> mApzcTreeManager;
// The most recently seen layer observer epoch in RecvSetDocShellIsActive.
uint64_t mLayerObserverEpoch;
#if defined(XP_WIN) && defined(ACCESSIBILITY)
// The handle associated with the native window that contains this tab
uintptr_t mNativeWindowHandle;
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -3,17 +3,16 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "base/basictypes.h"
#include "TabParent.h"
-#include "AudioChannelService.h"
#ifdef ACCESSIBILITY
#include "mozilla/a11y/DocAccessibleParent.h"
#include "nsAccessibilityService.h"
#endif
#include "mozilla/BrowserElementParent.h"
#include "mozilla/dom/ContentBridgeParent.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/DataTransfer.h"
@@ -299,40 +298,30 @@ TabParent::AddWindowListeners()
if (mFrameElement && mFrameElement->OwnerDoc()) {
if (nsCOMPtr<nsPIDOMWindowOuter> window = mFrameElement->OwnerDoc()->GetWindow()) {
nsCOMPtr<EventTarget> eventTarget = window->GetTopWindowRoot();
if (eventTarget) {
eventTarget->AddEventListener(NS_LITERAL_STRING("MozUpdateWindowPos"),
this, false, false);
}
}
-
- RefPtr<AudioChannelService> acs = AudioChannelService::GetOrCreate();
- if (acs) {
- acs->RegisterTabParent(this);
- }
}
}
void
TabParent::RemoveWindowListeners()
{
if (mFrameElement && mFrameElement->OwnerDoc()->GetWindow()) {
nsCOMPtr<nsPIDOMWindowOuter> window = mFrameElement->OwnerDoc()->GetWindow();
nsCOMPtr<EventTarget> eventTarget = window->GetTopWindowRoot();
if (eventTarget) {
eventTarget->RemoveEventListener(NS_LITERAL_STRING("MozUpdateWindowPos"),
this, false);
}
}
-
- RefPtr<AudioChannelService> acs = AudioChannelService::GetOrCreate();
- if (acs) {
- acs->UnregisterTabParent(this);
- }
}
bool
TabParent::IsVisible() const
{
RefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
if (!frameLoader) {
return false;
@@ -2527,38 +2516,16 @@ TabParent::GetRenderFrameInfo(TextureFac
return false;
}
*aLayersId = rfp->GetLayersId();
rfp->GetTextureFactoryIdentifier(aTextureFactoryIdentifier);
return true;
}
-mozilla::ipc::IPCResult
-TabParent::RecvAudioChannelActivityNotification(const uint32_t& aAudioChannel,
- const bool& aActive)
-{
- if (aAudioChannel >= NUMBER_OF_AUDIO_CHANNELS) {
- return IPC_FAIL_NO_REASON(this);
- }
-
- nsCOMPtr<nsIObserverService> os = services::GetObserverService();
- if (os) {
- nsAutoCString topic;
- topic.Assign("audiochannel-activity-");
- topic.Append(AudioChannelService::GetAudioChannelTable()[aAudioChannel].tag);
-
- os->NotifyObservers(NS_ISUPPORTS_CAST(nsITabParent*, this),
- topic.get(),
- aActive ? u"active" : u"inactive");
- }
-
- return IPC_OK();
-}
-
already_AddRefed<nsFrameLoader>
TabParent::GetFrameLoader(bool aUseCachedFrameLoaderAfterDestroy) const
{
if (mIsDestroyed && !aUseCachedFrameLoaderAfterDestroy) {
return nullptr;
}
if (mFrameLoader) {
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -615,19 +615,16 @@ protected:
virtual mozilla::ipc::IPCResult RecvForcePaintNoOp(const uint64_t& aLayerObserverEpoch) override;
virtual mozilla::ipc::IPCResult RecvSetDimensions(const uint32_t& aFlags,
const int32_t& aX, const int32_t& aY,
const int32_t& aCx, const int32_t& aCy) override;
virtual mozilla::ipc::IPCResult RecvGetTabCount(uint32_t* aValue) override;
- virtual mozilla::ipc::IPCResult RecvAudioChannelActivityNotification(const uint32_t& aAudioChannel,
- const bool& aActive) override;
-
virtual mozilla::ipc::IPCResult RecvSHistoryUpdate(const uint32_t& aCount,
const uint32_t& aLocalIndex,
const bool& aTruncate) override;
virtual mozilla::ipc::IPCResult RecvRequestCrossBrowserNavigation(const uint32_t& aGlobalIndex) override;
ContentCacheInParent mContentCache;
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5540,18 +5540,16 @@ pref("narrate.filter-voices", true);
#if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
// Whether to allow, on a Linux system that doesn't support the necessary sandboxing
// features, loading Gecko Media Plugins unsandboxed. However, EME CDMs will not be
// loaded without sandboxing even if this pref is changed.
pref("media.gmp.insecure.allow", false);
#endif
-pref("dom.audiochannel.mutedByDefault", false);
-
// HTML <dialog> element
pref("dom.dialog_element.enabled", false);
// Secure Element API
#ifdef MOZ_SECUREELEMENT
pref("dom.secureelement.enabled", false);
#endif
--- a/testing/profiles/prefs_general.js
+++ b/testing/profiles/prefs_general.js
@@ -337,18 +337,16 @@ user_pref("media.webspeech.synth.test",
user_pref("browser.urlbar.suggest.searches", false);
// Turn off the location bar search suggestions opt-in. It interferes with
// tests that don't expect it to be there.
user_pref("browser.urlbar.userMadeSearchSuggestionsChoice", true);
user_pref("browser.urlbar.usepreloadedtopurls.enabled", false);
-user_pref("dom.audiochannel.mutedByDefault", false);
-
user_pref("webextensions.tests", true);
user_pref("startup.homepage_welcome_url", "about:blank");
user_pref("startup.homepage_welcome_url.additional", "");
// For Firefox 52 only, ESR will support non-Flash plugins while release will
// not, so we keep testing the non-Flash pathways
user_pref("plugin.load_flash_only", false);