Bug 1457137 - Move instead of copying strings returned from various GetDebugInfo functions for HTMLMediaElement::MozDumpDebugInfo. r?jya,gerald
MozReview-Commit-ID: LbZ0cWe7yb0
--- a/dom/media/ChannelMediaDecoder.cpp
+++ b/dom/media/ChannelMediaDecoder.cpp
@@ -613,17 +613,17 @@ ChannelMediaDecoder::MetadataLoaded(
MediaDecoder::MetadataLoaded(Move(aInfo), Move(aTags), aEventVisibility);
// Set mode to PLAYBACK after reading metadata.
mResource->SetReadMode(MediaCacheStream::MODE_PLAYBACK);
}
nsCString
ChannelMediaDecoder::GetDebugInfo()
{
- auto&& str = MediaDecoder::GetDebugInfo();
+ nsCString str = MediaDecoder::GetDebugInfo();
if (mResource) {
AppendStringIfNotEmpty(str, mResource->GetDebugInfo());
}
return str;
}
} // namespace mozilla
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -3801,17 +3801,17 @@ MediaDecoderStateMachine::GetDebugInfo()
mDecodedAudioEndTime.ToMicroseconds(),
mDecodedVideoEndTime.ToMicroseconds(),
mAudioCompleted,
mVideoCompleted,
mStateObj->GetDebugInfo().get());
AppendStringIfNotEmpty(str, mMediaSink->GetDebugInfo());
- return str;
+ return Move(str);
}
RefPtr<MediaDecoder::DebugInfoPromise>
MediaDecoderStateMachine::RequestDebugInfo()
{
using PromiseType = MediaDecoder::DebugInfoPromise;
RefPtr<PromiseType::Private> p = new PromiseType::Private(__func__);
RefPtr<MediaDecoderStateMachine> self = this;
--- a/dom/media/mediasink/AudioSinkWrapper.cpp
+++ b/dom/media/mediasink/AudioSinkWrapper.cpp
@@ -253,14 +253,14 @@ AudioSinkWrapper::GetDebugInfo()
auto str =
nsPrintfCString("AudioSinkWrapper: IsStarted=%d IsPlaying=%d AudioEnded=%d",
IsStarted(),
IsPlaying(),
mAudioEnded);
if (mAudioSink) {
AppendStringIfNotEmpty(str, mAudioSink->GetDebugInfo());
}
- return str;
+ return Move(str);
}
} // namespace media
} // namespace mozilla
--- a/dom/media/mediasink/DecodedStream.cpp
+++ b/dom/media/mediasink/DecodedStream.cpp
@@ -797,12 +797,12 @@ DecodedStream::GetDebugInfo()
this,
startTime,
mLastOutputTime.ToMicroseconds(),
mPlaying,
mData.get());
if (mData) {
AppendStringIfNotEmpty(str, mData->GetDebugInfo());
}
- return str;
+ return Move(str);
}
} // namespace mozilla
--- a/dom/media/mediasink/VideoSink.cpp
+++ b/dom/media/mediasink/VideoSink.cpp
@@ -558,13 +558,13 @@ VideoSink::GetDebugInfo()
IsPlaying(),
VideoQueue().IsFinished(),
VideoQueue().GetSize(),
mVideoFrameEndTime.ToMicroseconds(),
mHasVideo,
mVideoSinkEndRequest.Exists(),
mEndPromiseHolder.IsEmpty());
AppendStringIfNotEmpty(str, mAudioSink->GetDebugInfo());
- return str;
+ return Move(str);
}
} // namespace media
} // namespace mozilla