mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-20 15:27:32 +09:00
[dom] Reorder some calls to improve memory safety
This commit is contained in:
parent
105c7abd40
commit
2442d307b5
1 changed files with 2 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue