Bug 865256 - Part 2: Rename WaveTable to PeriodicWave; r=roc

--HG--
rename : content/media/webaudio/WaveTable.cpp => content/media/webaudio/PeriodicWave.cpp
rename : content/media/webaudio/WaveTable.h => content/media/webaudio/PeriodicWave.h
rename : content/media/webaudio/test/test_waveTable.html => content/media/webaudio/test/test_periodicWave.html
rename : dom/webidl/WaveTable.webidl => dom/webidl/PeriodicWave.webidl
This commit is contained in:
Ehsan Akhgari 2013-06-19 18:24:26 -04:00
parent 1ffef53796
commit cdc93d6b0e
12 changed files with 77 additions and 77 deletions

View File

@ -26,7 +26,7 @@
#include "ChannelSplitterNode.h"
#include "MediaStreamAudioDestinationNode.h"
#include "WaveShaperNode.h"
#include "WaveTable.h"
#include "PeriodicWave.h"
#include "ConvolverNode.h"
#include "nsNetUtil.h"
@ -325,10 +325,10 @@ AudioContext::CreateBiquadFilter()
return filterNode.forget();
}
already_AddRefed<WaveTable>
AudioContext::CreateWaveTable(const Float32Array& aRealData,
const Float32Array& aImagData,
ErrorResult& aRv)
already_AddRefed<PeriodicWave>
AudioContext::CreatePeriodicWave(const Float32Array& aRealData,
const Float32Array& aImagData,
ErrorResult& aRv)
{
if (aRealData.Length() != aImagData.Length() ||
aRealData.Length() == 0 ||
@ -337,10 +337,10 @@ AudioContext::CreateWaveTable(const Float32Array& aRealData,
return nullptr;
}
nsRefPtr<WaveTable> waveTable =
new WaveTable(this, aRealData.Data(), aRealData.Length(),
aImagData.Data(), aImagData.Length());
return waveTable.forget();
nsRefPtr<PeriodicWave> periodicWave =
new PeriodicWave(this, aRealData.Data(), aRealData.Length(),
aImagData.Data(), aImagData.Length());
return periodicWave.forget();
}
AudioListener*

View File

@ -56,7 +56,7 @@ class OfflineRenderSuccessCallback;
class PannerNode;
class ScriptProcessorNode;
class WaveShaperNode;
class WaveTable;
class PeriodicWave;
class AudioContext MOZ_FINAL : public nsDOMEventTargetHelper,
public EnableWebAudioCheck
@ -187,9 +187,9 @@ public:
already_AddRefed<BiquadFilterNode>
CreateBiquadFilter();
already_AddRefed<WaveTable>
CreateWaveTable(const Float32Array& aRealData, const Float32Array& aImagData,
ErrorResult& aRv);
already_AddRefed<PeriodicWave>
CreatePeriodicWave(const Float32Array& aRealData, const Float32Array& aImagData,
ErrorResult& aRv);
void DecodeAudioData(const ArrayBuffer& aBuffer,
DecodeSuccessCallback& aSuccessCallback,

View File

@ -0,0 +1,38 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* 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 "PeriodicWave.h"
#include "AudioContext.h"
#include "mozilla/dom/PeriodicWaveBinding.h"
namespace mozilla {
namespace dom {
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(PeriodicWave, mContext)
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(PeriodicWave, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(PeriodicWave, Release)
PeriodicWave::PeriodicWave(AudioContext* aContext,
const float* aRealData,
uint32_t aRealDataLength,
const float* aImagData,
uint32_t aImagDataLength)
: mContext(aContext)
{
MOZ_ASSERT(aContext);
SetIsDOMBinding();
}
JSObject*
PeriodicWave::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
{
return PeriodicWaveBinding::Wrap(aCx, aScope, this);
}
}
}

View File

@ -4,8 +4,8 @@
* 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/. */
#ifndef WaveTable_h_
#define WaveTable_h_
#ifndef PeriodicWave_h_
#define PeriodicWave_h_
#include "nsWrapperCache.h"
#include "nsCycleCollectionParticipant.h"
@ -18,18 +18,18 @@ namespace mozilla {
namespace dom {
class WaveTable MOZ_FINAL : public nsWrapperCache,
public EnableWebAudioCheck
class PeriodicWave MOZ_FINAL : public nsWrapperCache,
public EnableWebAudioCheck
{
public:
WaveTable(AudioContext* aContext,
const float* aRealData,
uint32_t aRealDataLength,
const float* aImagData,
uint32_t aImagDataLength);
PeriodicWave(AudioContext* aContext,
const float* aRealData,
uint32_t aRealDataLength,
const float* aImagData,
uint32_t aImagDataLength);
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WaveTable)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WaveTable)
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(PeriodicWave)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(PeriodicWave)
AudioContext* GetParentObject() const
{

View File

@ -1,38 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* 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 "WaveTable.h"
#include "AudioContext.h"
#include "mozilla/dom/WaveTableBinding.h"
namespace mozilla {
namespace dom {
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(WaveTable, mContext)
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(WaveTable, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(WaveTable, Release)
WaveTable::WaveTable(AudioContext* aContext,
const float* aRealData,
uint32_t aRealDataLength,
const float* aImagData,
uint32_t aImagDataLength)
: mContext(aContext)
{
MOZ_ASSERT(aContext);
SetIsDOMBinding();
}
JSObject*
WaveTable::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
{
return WaveTableBinding::Wrap(aCx, aScope, this);
}
}
}

View File

@ -42,9 +42,9 @@ EXPORTS.mozilla.dom += [
'MediaStreamAudioDestinationNode.h',
'OfflineAudioCompletionEvent.h',
'PannerNode.h',
'PeriodicWave.h',
'ScriptProcessorNode.h',
'WaveShaperNode.h',
'WaveTable.h',
]
CPP_SOURCES += [
@ -69,10 +69,10 @@ CPP_SOURCES += [
'MediaStreamAudioDestinationNode.cpp',
'OfflineAudioCompletionEvent.cpp',
'PannerNode.cpp',
'PeriodicWave.cpp',
'ScriptProcessorNode.cpp',
'ThreeDPoint.cpp',
'WaveShaperNode.cpp',
'WaveTable.cpp',
'WebAudioUtils.cpp',
]

View File

@ -70,6 +70,7 @@ MOCHITEST_FILES := \
test_offlineDestinationChannelCountMore.html \
test_pannerNode.html \
test_pannerNode_equalPower.html \
test_periodicWave.html \
test_scriptProcessorNode.html \
test_scriptProcessorNodeChannelCount.html \
test_scriptProcessorNodeZeroInputOutput.html \
@ -77,7 +78,6 @@ MOCHITEST_FILES := \
test_waveShaper.html \
test_waveShaperNoCurve.html \
test_waveShaperZeroLengthCurve.html \
test_waveTable.html \
ting.ogg \
ting-expected.wav \
ting-dualchannel44.1.ogg \

View File

@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test the WaveTable interface</title>
<title>Test the PeriodicWave interface</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="webaudio.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
@ -16,15 +16,15 @@ addLoadEvent(function() {
var ac = new AudioContext();
var real = new Float32Array(4096);
var imag = new Float32Array(4096);
var table = ac.createWaveTable(real, imag);
var table = ac.createPeriodicWave(real, imag);
expectException(function() {
ac.createWaveTable(new Float32Array(512), imag);
ac.createPeriodicWave(new Float32Array(512), imag);
}, DOMException.NOT_SUPPORTED_ERR);
expectException(function() {
ac.createWaveTable(new Float32Array(0), new Float32Array(0));
ac.createPeriodicWave(new Float32Array(0), new Float32Array(0));
}, DOMException.NOT_SUPPORTED_ERR);
expectException(function() {
ac.createWaveTable(new Float32Array(4097), new Float32Array(4097));
ac.createPeriodicWave(new Float32Array(4097), new Float32Array(4097));
}, DOMException.NOT_SUPPORTED_ERR);
SpecialPowers.clearUserPref("media.webaudio.enabled");
SimpleTest.finish();

View File

@ -758,6 +758,10 @@ DOMInterfaces = {
'nativeOwnership': 'refcounted'
},
'PeriodicWave' : {
'nativeOwnership': 'refcounted'
},
'Position': {
'headerFile': 'nsGeoPosition.h'
},
@ -1124,10 +1128,6 @@ DOMInterfaces = {
'VideoStreamTrack': {
},
'WaveTable' : {
'nativeOwnership': 'refcounted'
},
'WebGLActiveInfo': {
'nativeType': 'mozilla::WebGLActiveInfo',
'headerFile': 'WebGLContext.h',

View File

@ -67,7 +67,7 @@ interface AudioContext : EventTarget {
DynamicsCompressorNode createDynamicsCompressor();
[Creator, Throws]
WaveTable createWaveTable(Float32Array real, Float32Array imag);
PeriodicWave createPeriodicWave(Float32Array real, Float32Array imag);
};

View File

@ -11,7 +11,7 @@
*/
[PrefControlled]
interface WaveTable {
interface PeriodicWave {
};

View File

@ -203,6 +203,7 @@ webidl_files = \
Performance.webidl \
PerformanceNavigation.webidl \
PerformanceTiming.webidl \
PeriodicWave.webidl \
Position.webidl \
PositionError.webidl \
ProcessingInstruction.webidl \
@ -346,7 +347,6 @@ webidl_files = \
URLUtils.webidl \
VideoStreamTrack.webidl \
WaveShaperNode.webidl \
WaveTable.webidl \
Window.webidl \
XMLDocument.webidl \
XMLHttpRequest.webidl \