Bug 1457137 - Move instead of copying strings returned from various GetDebugInfo functions for HTMLMediaElement::MozDumpDebugInfo. r?jya,gerald draft
authorPaul Adenot <paul@paul.cx>
Thu, 26 Apr 2018 15:57:39 +0200
changeset 788996 bc4e557f6e9463235102f00da052050fa8921c46
parent 788995 5b69d3b80b5247b6d11d82c9907c110c55896356
push id108127
push userpaul@paul.cx
push dateFri, 27 Apr 2018 09:57:10 +0000
reviewersjya, gerald
bugs1457137
milestone61.0a1
Bug 1457137 - Move instead of copying strings returned from various GetDebugInfo functions for HTMLMediaElement::MozDumpDebugInfo. r?jya,gerald MozReview-Commit-ID: LbZ0cWe7yb0
dom/media/ChannelMediaDecoder.cpp
dom/media/MediaDecoderStateMachine.cpp
dom/media/mediasink/AudioSinkWrapper.cpp
dom/media/mediasink/DecodedStream.cpp
dom/media/mediasink/VideoSink.cpp
--- 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