diff --git a/dom/audiochannel/AudioChannelService.cpp b/dom/audiochannel/AudioChannelService.cpp index 685593d1bddf..c448057815ef 100644 --- a/dom/audiochannel/AudioChannelService.cpp +++ b/dom/audiochannel/AudioChannelService.cpp @@ -330,8 +330,7 @@ AudioChannelService::IsEnableAudioCompeting() } NS_INTERFACE_MAP_BEGIN(AudioChannelService) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAudioChannelService) - NS_INTERFACE_MAP_ENTRY(nsIAudioChannelService) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIObserver) NS_INTERFACE_MAP_ENTRY(nsIObserver) NS_INTERFACE_MAP_END @@ -666,32 +665,6 @@ AudioChannelService::Observe(nsISupports* aSubject, const char* aTopic, return NS_OK; } -void -AudioChannelService::RefreshAgentsVolumeAndPropagate(AudioChannel aAudioChannel, - nsPIDOMWindowOuter* aWindow) -{ - MOZ_ASSERT(aWindow); - MOZ_ASSERT(aWindow->IsOuterWindow()); - - nsCOMPtr topWindow = aWindow->GetScriptableTop(); - if (!topWindow) { - return; - } - - AudioChannelWindow* winData = GetWindowData(topWindow->WindowID()); - if (!winData) { - return; - } - - for (uint32_t i = 0; i < mTabParents.Length(); ++i) { - mTabParents[i]->AudioChannelChangeNotification(aWindow, aAudioChannel, - winData->mChannels[(uint32_t)aAudioChannel].mVolume, - winData->mChannels[(uint32_t)aAudioChannel].mMuted); - } - - RefreshAgentsVolume(aWindow); -} - void AudioChannelService::RefreshAgents(nsPIDOMWindowOuter* aWindow, const std::function& aFunc) @@ -869,162 +842,6 @@ AudioChannelService::GetWindowData(uint64_t aWindowID) const return nullptr; } -float -AudioChannelService::GetAudioChannelVolume(nsPIDOMWindowOuter* aWindow, - AudioChannel aAudioChannel) -{ - MOZ_ASSERT(NS_IsMainThread()); - MOZ_ASSERT(aWindow); - MOZ_ASSERT(aWindow->IsOuterWindow()); - - AudioChannelWindow* winData = GetOrCreateWindowData(aWindow); - return winData->mChannels[(uint32_t)aAudioChannel].mVolume; -} - -NS_IMETHODIMP -AudioChannelService::GetAudioChannelVolume(mozIDOMWindowProxy* aWindow, - unsigned short aAudioChannel, - float* aVolume) -{ - MOZ_ASSERT(NS_IsMainThread()); - - auto* window = nsPIDOMWindowOuter::From(aWindow)->GetScriptableTop(); - if (!window) { - *aVolume = 0.f; - return NS_ERROR_FAILURE; - } - *aVolume = GetAudioChannelVolume(window, (AudioChannel)aAudioChannel); - return NS_OK; -} - -void -AudioChannelService::SetAudioChannelVolume(nsPIDOMWindowOuter* aWindow, - AudioChannel aAudioChannel, - float aVolume) -{ - MOZ_ASSERT(NS_IsMainThread()); - MOZ_ASSERT(aWindow); - MOZ_ASSERT(aWindow->IsOuterWindow()); - - MOZ_LOG(GetAudioChannelLog(), LogLevel::Debug, - ("AudioChannelService, SetAudioChannelVolume, window = %p, type = %" PRIu32 ", " - "volume = %f\n", aWindow, static_cast(aAudioChannel), aVolume)); - - AudioChannelWindow* winData = GetOrCreateWindowData(aWindow); - winData->mChannels[(uint32_t)aAudioChannel].mVolume = aVolume; - RefreshAgentsVolumeAndPropagate(aAudioChannel, aWindow); -} - -NS_IMETHODIMP -AudioChannelService::SetAudioChannelVolume(mozIDOMWindowProxy* aWindow, - unsigned short aAudioChannel, - float aVolume) -{ - MOZ_ASSERT(NS_IsMainThread()); - - auto* window = nsPIDOMWindowOuter::From(aWindow)->GetScriptableTop(); - if (!window) { - return NS_ERROR_FAILURE; - } - SetAudioChannelVolume(window, (AudioChannel)aAudioChannel, aVolume); - return NS_OK; -} - -bool -AudioChannelService::GetAudioChannelMuted(nsPIDOMWindowOuter* aWindow, - AudioChannel aAudioChannel) -{ - MOZ_ASSERT(NS_IsMainThread()); - MOZ_ASSERT(aWindow); - MOZ_ASSERT(aWindow->IsOuterWindow()); - - AudioChannelWindow* winData = GetOrCreateWindowData(aWindow); - return winData->mChannels[(uint32_t)aAudioChannel].mMuted; -} - -NS_IMETHODIMP -AudioChannelService::GetAudioChannelMuted(mozIDOMWindowProxy* aWindow, - unsigned short aAudioChannel, - bool* aMuted) -{ - MOZ_ASSERT(NS_IsMainThread()); - - auto* window = nsPIDOMWindowOuter::From(aWindow)->GetScriptableTop(); - if (!window) { - *aMuted = false; - return NS_ERROR_FAILURE; - } - *aMuted = GetAudioChannelMuted(window, (AudioChannel)aAudioChannel); - return NS_OK; -} - -void -AudioChannelService::SetAudioChannelMuted(nsPIDOMWindowOuter* aWindow, - AudioChannel aAudioChannel, - bool aMuted) -{ - MOZ_ASSERT(NS_IsMainThread()); - MOZ_ASSERT(aWindow); - MOZ_ASSERT(aWindow->IsOuterWindow()); - - MOZ_LOG(GetAudioChannelLog(), LogLevel::Debug, - ("AudioChannelService, SetAudioChannelMuted, window = %p, type = %" PRIu32 ", " - "mute = %s\n", aWindow, static_cast(aAudioChannel), - aMuted ? "true" : "false")); - - if (aAudioChannel == AudioChannel::System) { - // Workaround for bug1183033, system channel type can always playback. - return; - } - - AudioChannelWindow* winData = GetOrCreateWindowData(aWindow); - winData->mChannels[(uint32_t)aAudioChannel].mMuted = aMuted; - RefreshAgentsVolumeAndPropagate(aAudioChannel, aWindow); -} - -NS_IMETHODIMP -AudioChannelService::SetAudioChannelMuted(mozIDOMWindowProxy* aWindow, - unsigned short aAudioChannel, - bool aMuted) -{ - MOZ_ASSERT(NS_IsMainThread()); - - auto* window = nsPIDOMWindowOuter::From(aWindow)->GetScriptableTop(); - if (!window) { - return NS_ERROR_FAILURE; - } - SetAudioChannelMuted(window, (AudioChannel)aAudioChannel, aMuted); - return NS_OK; -} - -bool -AudioChannelService::IsAudioChannelActive(nsPIDOMWindowOuter* aWindow, - AudioChannel aAudioChannel) -{ - MOZ_ASSERT(NS_IsMainThread()); - MOZ_ASSERT(aWindow); - MOZ_ASSERT(aWindow->IsOuterWindow()); - - AudioChannelWindow* winData = GetOrCreateWindowData(aWindow); - return !!winData->mChannels[(uint32_t)aAudioChannel].mNumberOfAgents; -} - -NS_IMETHODIMP -AudioChannelService::IsAudioChannelActive(mozIDOMWindowProxy* aWindow, - unsigned short aAudioChannel, - bool* aActive) -{ - MOZ_ASSERT(NS_IsMainThread()); - - auto* window = nsPIDOMWindowOuter::From(aWindow)->GetScriptableTop(); - if (!window) { - *aActive = false; - return NS_ERROR_FAILURE; - } - *aActive = IsAudioChannelActive(window, (AudioChannel)aAudioChannel); - return NS_OK; -} - bool AudioChannelService::IsWindowActive(nsPIDOMWindowOuter* aWindow) { diff --git a/dom/audiochannel/AudioChannelService.h b/dom/audiochannel/AudioChannelService.h index e36a37046a28..651f718b51a4 100644 --- a/dom/audiochannel/AudioChannelService.h +++ b/dom/audiochannel/AudioChannelService.h @@ -7,7 +7,6 @@ #ifndef mozilla_dom_audiochannelservice_h__ #define mozilla_dom_audiochannelservice_h__ -#include "nsIAudioChannelService.h" #include "nsAutoPtr.h" #include "nsIObserver.h" #include "nsTObserverArray.h" @@ -58,13 +57,11 @@ public: uint32_t mSuspend; }; -class AudioChannelService final : public nsIAudioChannelService - , public nsIObserver +class AudioChannelService final : public nsIObserver { public: NS_DECL_ISUPPORTS NS_DECL_NSIOBSERVER - NS_DECL_NSIAUDIOCHANNELSERVICE /** * eNotAudible : agent is not audible @@ -142,19 +139,6 @@ public: AudibleState aAudible, AudibleChangedReasons aReason); - /* Methods for the BrowserElementAudioChannel */ - float GetAudioChannelVolume(nsPIDOMWindowOuter* aWindow, AudioChannel aChannel); - - void SetAudioChannelVolume(nsPIDOMWindowOuter* aWindow, AudioChannel aChannel, - float aVolume); - - bool GetAudioChannelMuted(nsPIDOMWindowOuter* aWindow, AudioChannel aChannel); - - void SetAudioChannelMuted(nsPIDOMWindowOuter* aWindow, AudioChannel aChannel, - bool aMuted); - - bool IsAudioChannelActive(nsPIDOMWindowOuter* aWindow, AudioChannel aChannel); - bool IsWindowActive(nsPIDOMWindowOuter* aWindow); /** @@ -184,9 +168,6 @@ public: void RefreshAgentsSuspend(nsPIDOMWindowOuter* aWindow, nsSuspendedTypes aSuspend); - void RefreshAgentsVolumeAndPropagate(AudioChannel aAudioChannel, - nsPIDOMWindowOuter* aWindow); - // 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 @@ -254,10 +235,7 @@ private: , mIsAudioCaptured(false) , mOwningAudioFocus(!AudioChannelService::IsEnableAudioCompeting()) , mShouldSendBlockStopEvent(false) - { - // Workaround for bug1183033, system channel type can always playback. - mChannels[(int16_t)AudioChannel::System].mMuted = false; - } + {} void AudioFocusChanged(AudioChannelAgent* aNewPlayingAgent); void AudioAudibleChanged(AudioChannelAgent* aAgent, diff --git a/dom/audiochannel/moz.build b/dom/audiochannel/moz.build index d4b02a35e15f..9eda18aa1e90 100644 --- a/dom/audiochannel/moz.build +++ b/dom/audiochannel/moz.build @@ -9,7 +9,6 @@ with Files("**"): XPIDL_SOURCES += [ 'nsIAudioChannelAgent.idl', - 'nsIAudioChannelService.idl', ] XPIDL_MODULE = 'dom_audiochannel' diff --git a/dom/audiochannel/nsIAudioChannelService.idl b/dom/audiochannel/nsIAudioChannelService.idl deleted file mode 100644 index 2c154a84b3e2..000000000000 --- a/dom/audiochannel/nsIAudioChannelService.idl +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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 "nsISupports.idl" - -interface mozIDOMWindowProxy; - -[scriptable, builtinclass, uuid(5cb24dbc-36c7-46a4-9966-ac73141dc795)] -interface nsIAudioChannelService : nsISupports -{ - float getAudioChannelVolume(in mozIDOMWindowProxy window, - in unsigned short audioChannel); - - void setAudioChannelVolume(in mozIDOMWindowProxy window, - in unsigned short audioChannel, - in float volume); - - boolean getAudioChannelMuted(in mozIDOMWindowProxy window, - in unsigned short audioChannel); - - void setAudioChannelMuted(in mozIDOMWindowProxy window, - in unsigned short audioChannel, - in boolean muted); - - boolean isAudioChannelActive(in mozIDOMWindowProxy window, - in unsigned short audioChannel); -}; diff --git a/dom/browser-element/BrowserElementChildPreload.js b/dom/browser-element/BrowserElementChildPreload.js index 80e5707f26e0..e6785fe1b0c7 100644 --- a/dom/browser-element/BrowserElementChildPreload.js +++ b/dom/browser-element/BrowserElementChildPreload.js @@ -18,9 +18,6 @@ Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/BrowserElementPromptService.jsm"); Cu.import("resource://gre/modules/Task.jsm"); -XPCOMUtils.defineLazyServiceGetter(this, "acs", - "@mozilla.org/audiochannel/service;1", - "nsIAudioChannelService"); XPCOMUtils.defineLazyModuleGetter(this, "ManifestFinder", "resource://gre/modules/ManifestFinder.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "ManifestObtainer", @@ -316,11 +313,6 @@ BrowserElementChild.prototype = { "find-next": this._recvFindNext, "clear-match": this._recvClearMatch, "execute-script": this._recvExecuteScript, - "get-audio-channel-volume": this._recvGetAudioChannelVolume, - "set-audio-channel-volume": this._recvSetAudioChannelVolume, - "get-audio-channel-muted": this._recvGetAudioChannelMuted, - "set-audio-channel-muted": this._recvSetAudioChannelMuted, - "get-is-audio-channel-active": this._recvIsAudioChannelActive, "get-web-manifest": this._recvGetWebManifest, } @@ -1381,54 +1373,6 @@ BrowserElementChild.prototype = { docShell.contentViewer.fullZoom = data.json.zoom; }, - _recvGetAudioChannelVolume: function(data) { - debug("Received getAudioChannelVolume message: (" + data.json.id + ")"); - - let volume = acs.getAudioChannelVolume(content, - data.json.args.audioChannel); - sendAsyncMsg('got-audio-channel-volume', { - id: data.json.id, successRv: volume - }); - }, - - _recvSetAudioChannelVolume: function(data) { - debug("Received setAudioChannelVolume message: (" + data.json.id + ")"); - - acs.setAudioChannelVolume(content, - data.json.args.audioChannel, - data.json.args.volume); - sendAsyncMsg('got-set-audio-channel-volume', { - id: data.json.id, successRv: true - }); - }, - - _recvGetAudioChannelMuted: function(data) { - debug("Received getAudioChannelMuted message: (" + data.json.id + ")"); - - let muted = acs.getAudioChannelMuted(content, data.json.args.audioChannel); - sendAsyncMsg('got-audio-channel-muted', { - id: data.json.id, successRv: muted - }); - }, - - _recvSetAudioChannelMuted: function(data) { - debug("Received setAudioChannelMuted message: (" + data.json.id + ")"); - - acs.setAudioChannelMuted(content, data.json.args.audioChannel, - data.json.args.muted); - sendAsyncMsg('got-set-audio-channel-muted', { - id: data.json.id, successRv: true - }); - }, - - _recvIsAudioChannelActive: function(data) { - debug("Received isAudioChannelActive message: (" + data.json.id + ")"); - - let active = acs.isAudioChannelActive(content, data.json.args.audioChannel); - sendAsyncMsg('got-is-audio-channel-active', { - id: data.json.id, successRv: active - }); - }, _recvGetWebManifest: Task.async(function* (data) { debug(`Received GetWebManifest message: (${data.json.id})`); let manifest = null; diff --git a/dom/browser-element/BrowserElementParent.js b/dom/browser-element/BrowserElementParent.js index e07774983770..c4486f5da805 100644 --- a/dom/browser-element/BrowserElementParent.js +++ b/dom/browser-element/BrowserElementParent.js @@ -180,11 +180,6 @@ BrowserElementParent.prototype = { "caretstatechanged": this._handleCaretStateChanged, "findchange": this._handleFindChange, "execute-script-done": this._gotDOMRequestResult, - "got-audio-channel-volume": this._gotDOMRequestResult, - "got-set-audio-channel-volume": this._gotDOMRequestResult, - "got-audio-channel-muted": this._gotDOMRequestResult, - "got-set-audio-channel-muted": this._gotDOMRequestResult, - "got-is-audio-channel-active": this._gotDOMRequestResult, "got-web-manifest": this._gotDOMRequestResult, }; @@ -896,33 +891,6 @@ BrowserElementParent.prototype = { } }, - getAudioChannelVolume: function(aAudioChannel) { - return this._sendDOMRequest('get-audio-channel-volume', - {audioChannel: aAudioChannel}); - }, - - setAudioChannelVolume: function(aAudioChannel, aVolume) { - return this._sendDOMRequest('set-audio-channel-volume', - {audioChannel: aAudioChannel, - volume: aVolume}); - }, - - getAudioChannelMuted: function(aAudioChannel) { - return this._sendDOMRequest('get-audio-channel-muted', - {audioChannel: aAudioChannel}); - }, - - setAudioChannelMuted: function(aAudioChannel, aMuted) { - return this._sendDOMRequest('set-audio-channel-muted', - {audioChannel: aAudioChannel, - muted: aMuted}); - }, - - isAudioChannelActive: function(aAudioChannel) { - return this._sendDOMRequest('get-is-audio-channel-active', - {audioChannel: aAudioChannel}); - }, - getWebManifest: defineDOMRequestMethod('get-web-manifest'), /** * Called when the visibility of the window which owns this iframe changes. diff --git a/dom/browser-element/nsIBrowserElementAPI.idl b/dom/browser-element/nsIBrowserElementAPI.idl index 159a0f400113..df0efa76b706 100644 --- a/dom/browser-element/nsIBrowserElementAPI.idl +++ b/dom/browser-element/nsIBrowserElementAPI.idl @@ -92,14 +92,6 @@ interface nsIBrowserElementAPI : nsISupports void addNextPaintListener(in nsIBrowserElementNextPaintListener listener); void removeNextPaintListener(in nsIBrowserElementNextPaintListener listener); - nsIDOMDOMRequest getAudioChannelVolume(in uint32_t audioChannel); - nsIDOMDOMRequest setAudioChannelVolume(in uint32_t audioChannel, in float volume); - - nsIDOMDOMRequest getAudioChannelMuted(in uint32_t audioChannel); - nsIDOMDOMRequest setAudioChannelMuted(in uint32_t audioChannel, in bool muted); - - nsIDOMDOMRequest isAudioChannelActive(in uint32_t audioChannel); - nsIDOMDOMRequest executeScript(in DOMString script, in jsval options); /** diff --git a/dom/ipc/PBrowser.ipdl b/dom/ipc/PBrowser.ipdl index 6abab4fa0311..b6f479f37d95 100644 --- a/dom/ipc/PBrowser.ipdl +++ b/dom/ipc/PBrowser.ipdl @@ -827,13 +827,6 @@ child: async HandleAccessKey(WidgetKeyboardEvent event, uint32_t[] charCodes, int32_t modifierMask); - /** - * Propagate a refresh to the child process - */ - async AudioChannelChangeNotification(uint32_t aAudioChannel, - float aVolume, - bool aMuted); - /** * Tells the root child docShell whether or not to use * global history. This is sent right after the PBrowser diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index fdabe8566968..c68445a11179 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -2321,27 +2321,6 @@ TabChild::RecvHandleAccessKey(const WidgetKeyboardEvent& aEvent, return IPC_OK(); } -mozilla::ipc::IPCResult -TabChild::RecvAudioChannelChangeNotification(const uint32_t& aAudioChannel, - const float& aVolume, - const bool& aMuted) -{ - nsCOMPtr window = do_GetInterface(WebNavigation()); - if (window) { - RefPtr service = AudioChannelService::GetOrCreate(); - MOZ_ASSERT(service); - - service->SetAudioChannelVolume(window, - static_cast(aAudioChannel), - aVolume); - service->SetAudioChannelMuted(window, - static_cast(aAudioChannel), - aMuted); - } - - return IPC_OK(); -} - mozilla::ipc::IPCResult TabChild::RecvSetUseGlobalHistory(const bool& aUse) { diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h index ebf16eaedbb7..63be9dca00df 100644 --- a/dom/ipc/TabChild.h +++ b/dom/ipc/TabChild.h @@ -590,10 +590,6 @@ public: nsTArray&& aCharCodes, const int32_t& aModifierMask) override; - virtual mozilla::ipc::IPCResult RecvAudioChannelChangeNotification(const uint32_t& aAudioChannel, - const float& aVolume, - const bool& aMuted) override; - virtual mozilla::ipc::IPCResult RecvSetUseGlobalHistory(const bool& aUse) override; virtual mozilla::ipc::IPCResult RecvHandledWindowedPluginKeyEvent( diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index dfa880f781ff..5b594c7bb048 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -3217,33 +3217,6 @@ TabParent::GetShowInfo() false, mDPI, mRounding, mDefaultScale.scale); } -void -TabParent::AudioChannelChangeNotification(nsPIDOMWindowOuter* aWindow, - AudioChannel aAudioChannel, - float aVolume, - bool aMuted) -{ - if (!mFrameElement || !mFrameElement->OwnerDoc()) { - return; - } - - nsCOMPtr window = mFrameElement->OwnerDoc()->GetWindow(); - while (window) { - if (window == aWindow) { - Unused << SendAudioChannelChangeNotification(static_cast(aAudioChannel), - aVolume, aMuted); - break; - } - - nsCOMPtr win = window->GetScriptableParentOrNull(); - if (!win) { - break; - } - - window = win; - } -} - mozilla::ipc::IPCResult TabParent::RecvGetTabCount(uint32_t* aValue) { diff --git a/dom/ipc/TabParent.h b/dom/ipc/TabParent.h index 2ad73424fd10..11c4e115db5d 100644 --- a/dom/ipc/TabParent.h +++ b/dom/ipc/TabParent.h @@ -577,10 +577,6 @@ public: layout::RenderFrameParent* GetRenderFrame(); - void AudioChannelChangeNotification(nsPIDOMWindowOuter* aWindow, - AudioChannel aAudioChannel, - float aVolume, - bool aMuted); bool SetRenderFrame(PRenderFrameParent* aRFParent); bool GetRenderFrameInfo(TextureFactoryIdentifier* aTextureFactoryIdentifier, uint64_t* aLayersId);