Bug 1460907 - Implement AudioParamMap definitions. r=karlt,qdot draft
authorArnaud Bienner <arnaud.bienner@gmail.com>
Sun, 13 May 2018 16:16:23 +0200
changeset 801841 b72d898550289f0637d7cb1c9796a12a7b4fc782
parent 798084 b75acf9652937ce79a9bf02de843c100db0e5ec7
push id111754
push userbmo:arnaud.bienner@gmail.com
push dateWed, 30 May 2018 21:12:38 +0000
reviewerskarlt, qdot
bugs1460907
milestone62.0a1
Bug 1460907 - Implement AudioParamMap definitions. r=karlt,qdot MozReview-Commit-ID: AdsI9QU3VOX
dom/media/webaudio/AudioParamMap.cpp
dom/media/webaudio/AudioParamMap.h
dom/media/webaudio/moz.build
dom/tests/mochitest/general/test_interfaces.js
dom/webidl/AudioParamMap.webidl
dom/webidl/moz.build
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',