Bug 1460907 - Implement AudioParamMap definitions. r=karlt,qdot
MozReview-Commit-ID: AdsI9QU3VOX
new file mode 100644
--- /dev/null
+++ b/dom/media/webaudio/AudioParamMap.cpp
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* 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 https://mozilla.org/MPL/2.0/. */
+
+#include "AudioParamMap.h"
+#include "mozilla/dom/AudioParamMapBinding.h"
+
+namespace mozilla {
+namespace dom {
+
+NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(AudioParamMap, mParent)
+
+NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(AudioParamMap, AddRef)
+NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(AudioParamMap, Release)
+
+AudioParamMap::AudioParamMap(nsPIDOMWindowInner* aParent) :
+ mParent(aParent)
+{
+}
+
+JSObject*
+AudioParamMap::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
+{
+ return AudioParamMapBinding::Wrap(aCx, this, aGivenProto);
+}
+
+} // namespace dom
+} // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/dom/media/webaudio/AudioParamMap.h
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* 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 https://mozilla.org/MPL/2.0/. */
+
+#ifndef AudioParamMap_h_
+#define AudioParamMap_h_
+
+#include "nsWrapperCache.h"
+#include "nsCOMPtr.h"
+
+class nsPIDOMWindowInner;
+
+namespace mozilla {
+namespace dom {
+
+class AudioParamMap final : public nsWrapperCache
+{
+public:
+ NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(AudioParamMap)
+ NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(AudioParamMap)
+
+ explicit AudioParamMap(nsPIDOMWindowInner* aParent);
+
+ nsPIDOMWindowInner* GetParentObject() const { return mParent; }
+
+ JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
+
+private:
+ ~AudioParamMap() = default;
+ nsCOMPtr<nsPIDOMWindowInner> mParent;
+};
+
+} // namespace dom
+} // namespace mozilla
+
+#endif // AudioParamMap_h_
\ No newline at end of file
--- a/dom/media/webaudio/moz.build
+++ b/dom/media/webaudio/moz.build
@@ -44,16 +44,17 @@ EXPORTS.mozilla.dom += [
'AnalyserNode.h',
'AudioBuffer.h',
'AudioBufferSourceNode.h',
'AudioContext.h',
'AudioDestinationNode.h',
'AudioListener.h',
'AudioNode.h',
'AudioParam.h',
+ 'AudioParamMap.h',
'AudioProcessingEvent.h',
'AudioScheduledSourceNode.h',
'BiquadFilterNode.h',
'ChannelMergerNode.h',
'ChannelSplitterNode.h',
'ConstantSourceNode.h',
'ConvolverNode.h',
'DelayNode.h',
@@ -80,16 +81,17 @@ UNIFIED_SOURCES += [
'AudioDestinationNode.cpp',
'AudioEventTimeline.cpp',
'AudioListener.cpp',
'AudioNode.cpp',
'AudioNodeEngine.cpp',
'AudioNodeExternalInputStream.cpp',
'AudioNodeStream.cpp',
'AudioParam.cpp',
+ 'AudioParamMap.cpp',
'AudioProcessingEvent.cpp',
'AudioScheduledSourceNode.cpp',
'BiquadFilterNode.cpp',
'ChannelMergerNode.cpp',
'ChannelSplitterNode.cpp',
'ConstantSourceNode.cpp',
'ConvolverNode.cpp',
'DelayBuffer.cpp',
--- a/dom/tests/mochitest/general/test_interfaces.js
+++ b/dom/tests/mochitest/general/test_interfaces.js
@@ -146,16 +146,18 @@ var interfaceNamesInGlobalScope =
{name: "AudioDestinationNode", insecureContext: true},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "AudioListener", insecureContext: true},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "AudioNode", insecureContext: true},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "AudioParam", insecureContext: true},
// IMPORTANT: Do not change this list without review from a DOM peer!
+ {name: "AudioParamMap", insecureContext: true, disabled: true},
+// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "AudioProcessingEvent", insecureContext: true},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "AudioScheduledSourceNode", insecureContext: true},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "AudioStreamTrack", insecureContext: true},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "AuthenticatorAssertionResponse"},
// IMPORTANT: Do not change this list without review from a DOM peer!
new file mode 100644
--- /dev/null
+++ b/dom/webidl/AudioParamMap.webidl
@@ -0,0 +1,16 @@
+/* -*- 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/.
+ *
+ * The origin of this IDL file is
+ * https://webaudio.github.io/web-audio-api/#audioparammap
+ *
+ * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
+ * liability, trademark and document use rules apply.
+ */
+
+[Pref="dom.audioworklet.enabled"]
+interface AudioParamMap {
+ readonly maplike<DOMString, AudioParam>;
+};
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -374,16 +374,17 @@ WEBIDL_FILES = [
'Attr.webidl',
'AudioBuffer.webidl',
'AudioBufferSourceNode.webidl',
'AudioContext.webidl',
'AudioDestinationNode.webidl',
'AudioListener.webidl',
'AudioNode.webidl',
'AudioParam.webidl',
+ 'AudioParamMap.webidl',
'AudioProcessingEvent.webidl',
'AudioScheduledSourceNode.webidl',
'AudioStreamTrack.webidl',
'AudioTrack.webidl',
'AudioTrackList.webidl',
'AudioWorkletGlobalScope.webidl',
'AutocompleteInfo.webidl',
'BarProp.webidl',