2012-09-22 02:42:14 +04:00
|
|
|
/* -*- 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 "AudioBuffer.h"
|
|
|
|
#include "mozilla/dom/AudioBufferBinding.h"
|
|
|
|
#include "jsfriendapi.h"
|
|
|
|
#include "mozilla/ErrorResult.h"
|
2013-02-05 03:07:25 +04:00
|
|
|
#include "AudioSegment.h"
|
2013-05-05 19:15:58 +04:00
|
|
|
#include "AudioChannelFormat.h"
|
|
|
|
#include "mozilla/PodOperations.h"
|
2013-09-28 04:11:26 +04:00
|
|
|
#include "mozilla/CheckedInt.h"
|
2013-08-15 23:44:14 +04:00
|
|
|
#include "AudioNodeEngine.h"
|
2012-09-22 02:42:14 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2013-08-02 05:29:05 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_CLASS(AudioBuffer)
|
|
|
|
|
2012-09-22 02:42:14 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(AudioBuffer)
|
2012-11-15 11:32:40 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mContext)
|
2013-02-05 03:07:25 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mJSChannels)
|
2012-09-22 02:42:14 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
2013-01-26 01:21:22 +04:00
|
|
|
tmp->ClearJSChannels();
|
2012-09-22 02:42:14 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(AudioBuffer)
|
2012-11-15 11:32:40 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mContext)
|
2012-09-22 02:42:14 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(AudioBuffer)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
|
2013-02-05 03:07:25 +04:00
|
|
|
for (uint32_t i = 0; i < tmp->mJSChannels.Length(); ++i) {
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mJSChannels[i])
|
2012-09-22 02:42:14 +04:00
|
|
|
}
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
|
|
|
|
2013-07-06 00:21:52 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(AudioBuffer, AddRef)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(AudioBuffer, Release)
|
2012-09-22 02:42:14 +04:00
|
|
|
|
2014-05-16 01:23:27 +04:00
|
|
|
AudioBuffer::AudioBuffer(AudioContext* aContext, uint32_t aNumberOfChannels,
|
|
|
|
uint32_t aLength, float aSampleRate)
|
2012-09-22 02:42:14 +04:00
|
|
|
: mContext(aContext),
|
|
|
|
mLength(aLength),
|
|
|
|
mSampleRate(aSampleRate)
|
|
|
|
{
|
2014-05-16 01:23:27 +04:00
|
|
|
mJSChannels.SetCapacity(aNumberOfChannels);
|
2013-08-17 00:10:17 +04:00
|
|
|
mozilla::HoldJSObjects(this);
|
2012-09-22 02:42:14 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
AudioBuffer::~AudioBuffer()
|
2013-01-26 01:21:22 +04:00
|
|
|
{
|
|
|
|
ClearJSChannels();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
AudioBuffer::ClearJSChannels()
|
2012-09-22 02:42:14 +04:00
|
|
|
{
|
2013-02-05 03:07:25 +04:00
|
|
|
mJSChannels.Clear();
|
2013-08-17 00:10:17 +04:00
|
|
|
mozilla::DropJSObjects(this);
|
2012-09-22 02:42:14 +04:00
|
|
|
}
|
|
|
|
|
2014-05-16 01:23:27 +04:00
|
|
|
/* static */ already_AddRefed<AudioBuffer>
|
|
|
|
AudioBuffer::Create(AudioContext* aContext, uint32_t aNumberOfChannels,
|
|
|
|
uint32_t aLength, float aSampleRate,
|
|
|
|
JSContext* aJSContext, ErrorResult& aRv)
|
2012-09-22 02:42:14 +04:00
|
|
|
{
|
2014-05-16 01:23:27 +04:00
|
|
|
// Note that a buffer with zero channels is permitted here for the sake of
|
|
|
|
// AudioProcessingEvent, where channel counts must match parameters passed
|
|
|
|
// to createScriptProcessor(), one of which may be zero.
|
|
|
|
if (aSampleRate < WebAudioUtils::MinSampleRate ||
|
|
|
|
aSampleRate > WebAudioUtils::MaxSampleRate ||
|
2014-05-16 01:23:38 +04:00
|
|
|
aNumberOfChannels > WebAudioUtils::MaxChannelCount ||
|
2014-05-16 01:23:27 +04:00
|
|
|
!aLength || aLength > INT32_MAX) {
|
|
|
|
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
|
|
|
return nullptr;
|
2012-09-22 02:42:14 +04:00
|
|
|
}
|
2014-05-16 01:23:27 +04:00
|
|
|
|
|
|
|
nsRefPtr<AudioBuffer> buffer =
|
|
|
|
new AudioBuffer(aContext, aNumberOfChannels, aLength, aSampleRate);
|
|
|
|
|
2012-09-22 02:42:14 +04:00
|
|
|
for (uint32_t i = 0; i < aNumberOfChannels; ++i) {
|
2013-11-11 12:04:41 +04:00
|
|
|
JS::Rooted<JSObject*> array(aJSContext,
|
2014-05-16 01:23:27 +04:00
|
|
|
JS_NewFloat32Array(aJSContext, aLength));
|
2012-09-22 02:42:14 +04:00
|
|
|
if (!array) {
|
2014-05-16 01:23:27 +04:00
|
|
|
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
return nullptr;
|
2012-09-22 02:42:14 +04:00
|
|
|
}
|
2014-05-16 01:23:27 +04:00
|
|
|
buffer->mJSChannels.AppendElement(array.get());
|
2012-09-22 02:42:14 +04:00
|
|
|
}
|
|
|
|
|
2014-05-16 01:23:27 +04:00
|
|
|
return buffer.forget();
|
2012-09-22 02:42:14 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
JSObject*
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 17:13:33 +03:00
|
|
|
AudioBuffer::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
2012-09-22 02:42:14 +04:00
|
|
|
{
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 17:13:33 +03:00
|
|
|
return AudioBufferBinding::Wrap(aCx, this, aGivenProto);
|
2012-09-22 02:42:14 +04:00
|
|
|
}
|
|
|
|
|
2013-05-05 01:40:20 +04:00
|
|
|
bool
|
2013-02-05 03:07:25 +04:00
|
|
|
AudioBuffer::RestoreJSChannelData(JSContext* aJSContext)
|
|
|
|
{
|
|
|
|
if (mSharedChannels) {
|
|
|
|
for (uint32_t i = 0; i < mJSChannels.Length(); ++i) {
|
|
|
|
const float* data = mSharedChannels->GetData(i);
|
|
|
|
// The following code first zeroes the array and then copies our data
|
|
|
|
// into it. We could avoid this with additional JS APIs to construct
|
|
|
|
// an array (or ArrayBuffer) containing initial data.
|
2013-11-11 12:04:41 +04:00
|
|
|
JS::Rooted<JSObject*> array(aJSContext,
|
|
|
|
JS_NewFloat32Array(aJSContext, mLength));
|
2013-05-05 01:40:20 +04:00
|
|
|
if (!array) {
|
|
|
|
return false;
|
|
|
|
}
|
2014-10-07 21:44:07 +04:00
|
|
|
JS::AutoCheckCannotGC nogc;
|
|
|
|
mozilla::PodCopy(JS_GetFloat32ArrayData(array, nogc), data, mLength);
|
2013-02-05 03:07:25 +04:00
|
|
|
mJSChannels[i] = array;
|
|
|
|
}
|
|
|
|
|
|
|
|
mSharedChannels = nullptr;
|
|
|
|
}
|
2013-05-05 01:40:20 +04:00
|
|
|
|
|
|
|
return true;
|
2013-02-05 03:07:25 +04:00
|
|
|
}
|
|
|
|
|
2013-09-17 15:30:32 +04:00
|
|
|
void
|
|
|
|
AudioBuffer::CopyFromChannel(const Float32Array& aDestination, uint32_t aChannelNumber,
|
|
|
|
uint32_t aStartInChannel, ErrorResult& aRv)
|
|
|
|
{
|
Bug 999651, bug 995679, bug 1009952, bug 1011007, bug 991981. r=sfink, r=shu, r=jandem, r=jdm, r=luke, r=bbouvier, r=nmatsakis, r=bz, r=ehsan, r=jgilbert, r=smaug, r=sicking, r=terrence, r=bholley, r=bent, r=efaust, r=jorendorff
2014-05-28 01:32:41 +04:00
|
|
|
aDestination.ComputeLengthAndData();
|
|
|
|
|
2013-09-17 15:30:32 +04:00
|
|
|
uint32_t length = aDestination.Length();
|
2013-09-28 04:11:26 +04:00
|
|
|
CheckedInt<uint32_t> end = aStartInChannel;
|
|
|
|
end += length;
|
2013-09-17 15:30:32 +04:00
|
|
|
if (aChannelNumber >= NumberOfChannels() ||
|
2013-10-09 06:32:16 +04:00
|
|
|
!end.isValid() || end.value() > mLength) {
|
2013-09-17 15:30:32 +04:00
|
|
|
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!mSharedChannels && JS_GetTypedArrayLength(mJSChannels[aChannelNumber]) != mLength) {
|
|
|
|
// The array was probably neutered
|
|
|
|
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-10-07 21:44:07 +04:00
|
|
|
JS::AutoCheckCannotGC nogc;
|
2013-09-17 15:30:32 +04:00
|
|
|
const float* sourceData = mSharedChannels ?
|
|
|
|
mSharedChannels->GetData(aChannelNumber) :
|
2014-10-07 21:44:07 +04:00
|
|
|
JS_GetFloat32ArrayData(mJSChannels[aChannelNumber], nogc);
|
2013-11-05 04:02:55 +04:00
|
|
|
PodMove(aDestination.Data(), sourceData + aStartInChannel, length);
|
2013-09-17 15:30:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
AudioBuffer::CopyToChannel(JSContext* aJSContext, const Float32Array& aSource,
|
|
|
|
uint32_t aChannelNumber, uint32_t aStartInChannel,
|
|
|
|
ErrorResult& aRv)
|
|
|
|
{
|
Bug 999651, bug 995679, bug 1009952, bug 1011007, bug 991981. r=sfink, r=shu, r=jandem, r=jdm, r=luke, r=bbouvier, r=nmatsakis, r=bz, r=ehsan, r=jgilbert, r=smaug, r=sicking, r=terrence, r=bholley, r=bent, r=efaust, r=jorendorff
2014-05-28 01:32:41 +04:00
|
|
|
aSource.ComputeLengthAndData();
|
|
|
|
|
2013-09-17 15:30:32 +04:00
|
|
|
uint32_t length = aSource.Length();
|
2013-09-28 04:11:26 +04:00
|
|
|
CheckedInt<uint32_t> end = aStartInChannel;
|
|
|
|
end += length;
|
2013-09-17 15:30:32 +04:00
|
|
|
if (aChannelNumber >= NumberOfChannels() ||
|
2013-10-09 06:32:16 +04:00
|
|
|
!end.isValid() || end.value() > mLength) {
|
2013-09-17 15:30:32 +04:00
|
|
|
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!mSharedChannels && JS_GetTypedArrayLength(mJSChannels[aChannelNumber]) != mLength) {
|
|
|
|
// The array was probably neutered
|
|
|
|
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!RestoreJSChannelData(aJSContext)) {
|
|
|
|
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-10-07 21:44:07 +04:00
|
|
|
JS::AutoCheckCannotGC nogc;
|
|
|
|
PodMove(JS_GetFloat32ArrayData(mJSChannels[aChannelNumber], nogc) + aStartInChannel,
|
2013-09-17 15:30:32 +04:00
|
|
|
aSource.Data(), length);
|
|
|
|
}
|
|
|
|
|
2013-04-14 05:37:04 +04:00
|
|
|
void
|
2014-05-09 13:16:03 +04:00
|
|
|
AudioBuffer::SetRawChannelContents(uint32_t aChannel, float* aContents)
|
2013-04-14 05:37:04 +04:00
|
|
|
{
|
2014-05-20 07:12:47 +04:00
|
|
|
MOZ_ASSERT(!GetWrapperPreserveColor() && !mSharedChannels,
|
|
|
|
"The AudioBuffer object should not have been handed to JS or have C++ callers neuter its typed array");
|
2014-10-07 21:44:07 +04:00
|
|
|
JS::AutoCheckCannotGC nogc;
|
|
|
|
PodCopy(JS_GetFloat32ArrayData(mJSChannels[aChannel], nogc), aContents, mLength);
|
2013-04-14 05:37:04 +04:00
|
|
|
}
|
|
|
|
|
2014-06-12 00:26:52 +04:00
|
|
|
void
|
2012-09-22 02:42:14 +04:00
|
|
|
AudioBuffer::GetChannelData(JSContext* aJSContext, uint32_t aChannel,
|
2014-06-12 00:26:52 +04:00
|
|
|
JS::MutableHandle<JSObject*> aRetval,
|
2013-02-05 03:07:25 +04:00
|
|
|
ErrorResult& aRv)
|
2012-09-22 02:42:14 +04:00
|
|
|
{
|
2013-02-05 03:07:25 +04:00
|
|
|
if (aChannel >= NumberOfChannels()) {
|
2012-09-22 02:42:14 +04:00
|
|
|
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
|
2014-06-12 00:26:52 +04:00
|
|
|
return;
|
2012-09-22 02:42:14 +04:00
|
|
|
}
|
2013-02-05 03:07:25 +04:00
|
|
|
|
2013-05-05 01:40:20 +04:00
|
|
|
if (!RestoreJSChannelData(aJSContext)) {
|
|
|
|
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
2014-06-12 00:26:52 +04:00
|
|
|
return;
|
2013-05-05 01:40:20 +04:00
|
|
|
}
|
2013-02-05 03:07:25 +04:00
|
|
|
|
2014-06-12 00:26:52 +04:00
|
|
|
if (mJSChannels[aChannel]) {
|
|
|
|
JS::ExposeObjectToActiveJS(mJSChannels[aChannel]);
|
|
|
|
}
|
|
|
|
aRetval.set(mJSChannels[aChannel]);
|
2013-02-02 02:13:23 +04:00
|
|
|
}
|
|
|
|
|
2013-02-05 03:07:25 +04:00
|
|
|
static already_AddRefed<ThreadSharedFloatArrayBufferList>
|
|
|
|
StealJSArrayDataIntoThreadSharedFloatArrayBufferList(JSContext* aJSContext,
|
|
|
|
const nsTArray<JSObject*>& aJSArrays)
|
|
|
|
{
|
|
|
|
nsRefPtr<ThreadSharedFloatArrayBufferList> result =
|
|
|
|
new ThreadSharedFloatArrayBufferList(aJSArrays.Length());
|
|
|
|
for (uint32_t i = 0; i < aJSArrays.Length(); ++i) {
|
2014-04-30 13:10:33 +04:00
|
|
|
JS::Rooted<JSObject*> arrayBufferView(aJSContext, aJSArrays[i]);
|
2013-11-11 12:04:41 +04:00
|
|
|
JS::Rooted<JSObject*> arrayBuffer(aJSContext,
|
2014-04-30 13:10:33 +04:00
|
|
|
JS_GetArrayBufferViewBuffer(aJSContext, arrayBufferView));
|
2014-03-17 21:46:04 +04:00
|
|
|
uint8_t* stolenData = arrayBuffer
|
|
|
|
? (uint8_t*) JS_StealArrayBufferContents(aJSContext, arrayBuffer)
|
|
|
|
: nullptr;
|
|
|
|
if (stolenData) {
|
2014-10-07 12:03:00 +04:00
|
|
|
result->SetData(i, stolenData, js_free, reinterpret_cast<float*>(stolenData));
|
2013-02-05 03:07:25 +04:00
|
|
|
} else {
|
2013-06-29 16:30:35 +04:00
|
|
|
return nullptr;
|
2013-02-05 03:07:25 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return result.forget();
|
2013-02-05 03:07:25 +04:00
|
|
|
}
|
2013-02-05 10:29:28 +04:00
|
|
|
|
2013-02-05 03:07:25 +04:00
|
|
|
ThreadSharedFloatArrayBufferList*
|
2013-04-22 16:12:45 +04:00
|
|
|
AudioBuffer::GetThreadSharedChannelsForRate(JSContext* aJSContext)
|
2013-02-05 03:07:25 +04:00
|
|
|
{
|
|
|
|
if (!mSharedChannels) {
|
2013-06-25 20:01:07 +04:00
|
|
|
for (uint32_t i = 0; i < mJSChannels.Length(); ++i) {
|
|
|
|
if (mLength != JS_GetTypedArrayLength(mJSChannels[i])) {
|
|
|
|
// Probably one of the arrays was neutered
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-05 03:07:25 +04:00
|
|
|
mSharedChannels =
|
|
|
|
StealJSArrayDataIntoThreadSharedFloatArrayBufferList(aJSContext, mJSChannels);
|
|
|
|
}
|
|
|
|
|
2013-03-19 04:54:32 +04:00
|
|
|
return mSharedChannels;
|
2013-02-05 03:07:25 +04:00
|
|
|
}
|
2013-03-08 03:14:46 +04:00
|
|
|
|
2014-01-04 22:15:41 +04:00
|
|
|
size_t
|
|
|
|
AudioBuffer::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
|
|
|
{
|
|
|
|
size_t amount = aMallocSizeOf(this);
|
2015-07-29 09:24:24 +03:00
|
|
|
amount += mJSChannels.ShallowSizeOfExcludingThis(aMallocSizeOf);
|
2014-01-04 22:15:41 +04:00
|
|
|
if (mSharedChannels) {
|
2014-05-01 21:37:54 +04:00
|
|
|
amount += mSharedChannels->SizeOfIncludingThis(aMallocSizeOf);
|
2014-01-04 22:15:41 +04:00
|
|
|
}
|
|
|
|
return amount;
|
|
|
|
}
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|