diff options
author | Moonchild <moonchild@palemoon.org> | 2020-05-06 00:30:30 +0000 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-05-06 19:16:20 +0200 |
commit | 09b4a7828e91f69069b4241b7d465266d930476b (patch) | |
tree | 31b807f9b0276de9276ea04c496fc65e008f6703 /dom/media | |
parent | ed58b7905e42562063058b283a90672e19d33ea0 (diff) | |
download | UXP-09b4a7828e91f69069b4241b7d465266d930476b.tar UXP-09b4a7828e91f69069b4241b7d465266d930476b.tar.gz UXP-09b4a7828e91f69069b4241b7d465266d930476b.tar.lz UXP-09b4a7828e91f69069b4241b7d465266d930476b.tar.xz UXP-09b4a7828e91f69069b4241b7d465266d930476b.zip |
[dom] Reorder some calls to improve memory safety
Diffstat (limited to 'dom/media')
-rw-r--r-- | dom/media/webaudio/AudioBuffer.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/dom/media/webaudio/AudioBuffer.cpp b/dom/media/webaudio/AudioBuffer.cpp index e7eba2d48..e4252dfcf 100644 --- a/dom/media/webaudio/AudioBuffer.cpp +++ b/dom/media/webaudio/AudioBuffer.cpp @@ -254,8 +254,6 @@ void AudioBuffer::CopyFromChannel(const Float32Array& aDestination, uint32_t aChannelNumber, uint32_t aStartInChannel, ErrorResult& aRv) { - aDestination.ComputeLengthAndData(); - uint32_t length = aDestination.Length(); CheckedInt<uint32_t> end = aStartInChannel; end += length; @@ -266,6 +264,7 @@ AudioBuffer::CopyFromChannel(const Float32Array& aDestination, uint32_t aChannel } JS::AutoCheckCannotGC nogc; + aDestination.ComputeLengthAndData(); JSObject* channelArray = mJSChannels[aChannelNumber]; const float* sourceData = nullptr; if (channelArray) { @@ -296,8 +295,6 @@ AudioBuffer::CopyToChannel(JSContext* aJSContext, const Float32Array& aSource, uint32_t aChannelNumber, uint32_t aStartInChannel, ErrorResult& aRv) { - aSource.ComputeLengthAndData(); - uint32_t length = aSource.Length(); CheckedInt<uint32_t> end = aStartInChannel; end += length; @@ -320,6 +317,7 @@ AudioBuffer::CopyToChannel(JSContext* aJSContext, const Float32Array& aSource, return; } + aSource.ComputeLengthAndData(); bool isShared = false; float* channelData = JS_GetFloat32ArrayData(channelArray, &isShared, nogc); // The channelData arrays should all have originated in |