Bug 1659950 - Move instead of copy where possible in nsMultiplexInputStream::SerializeInternal. r=froydnj

Differential Revision: https://phabricator.services.mozilla.com/D87574
This commit is contained in:
Simon Giesecke 2020-08-19 12:46:26 +00:00
parent 2378891a30
commit 6b1b0ed613

View File

@ -982,11 +982,10 @@ void nsMultiplexInputStream::SerializeInternal(
streams.SetCapacity(streamCount);
for (uint32_t index = 0; index < streamCount; index++) {
uint32_t sizeUsed = 0;
InputStreamParams childStreamParams;
InputStreamHelper::SerializeInputStream(
mStreams[index].mOriginalStream, childStreamParams, aFileDescriptors,
aDelayedStart, maxSize.value(), &sizeUsed, aManager);
streams.AppendElement(childStreamParams);
mStreams[index].mOriginalStream, *streams.AppendElement(),
aFileDescriptors, aDelayedStart, maxSize.value(), &sizeUsed,
aManager);
MOZ_ASSERT(maxSize.value() >= sizeUsed);
@ -1002,7 +1001,7 @@ void nsMultiplexInputStream::SerializeInternal(
params.status() = mStatus;
params.startedReadingCurrent() = mStartedReadingCurrent;
aParams = params;
aParams = std::move(params);
MOZ_ASSERT(aSizeUsed);
*aSizeUsed = totalSizeUsed.value();