[go: nahoru, domu]

Switch media/ to pass scoped_refptr<DecoderBuffer> by value.

This removes the usage of const scoped_refptr<DecoderBuffer>& in
favor of passing by value and using std::move.

I was experimenting with replacing it with std::unique_ptr,
but there are quite a few copies currently, so keeping it
ref counted seems reasonable for now. The conversion is half
the work, so I just finished it instead of reverting.

This fixes production code and tests which needed fixing to
compile; most other unittests are left untouched in terms of
using std::move optimally. Where possible inner functions have
been converted to const DecoderBuffer& where the pointer is
never expected to be null. Long chains of multiple inner
functions were converted to const DecoderBuffer*.

BUG=none
TEST=passes bots.

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I390bc4e2fd8048e8c1c1f7725e0cc173bdd88850
Reviewed-on: https://chromium-review.googlesource.com/994058
Reviewed-by: Kenneth MacKay <kmackay@chromium.org>
Reviewed-by: Chrome Cunningham <chcunningham@chromium.org>
Reviewed-by: Mustafa Emre Acer <meacer@chromium.org>
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#549258}
diff --git a/media/filters/decrypting_audio_decoder_unittest.cc b/media/filters/decrypting_audio_decoder_unittest.cc
index 93542a8..4214853 100644
--- a/media/filters/decrypting_audio_decoder_unittest.cc
+++ b/media/filters/decrypting_audio_decoder_unittest.cc
@@ -132,7 +132,7 @@
   }
 
   // Decode |buffer| and expect DecodeDone to get called with |status|.
-  void DecodeAndExpect(const scoped_refptr<DecoderBuffer>& buffer,
+  void DecodeAndExpect(scoped_refptr<DecoderBuffer> buffer,
                        DecodeStatus status) {
     EXPECT_CALL(*this, DecodeDone(status));
     decoder_->Decode(buffer,
@@ -143,7 +143,7 @@
 
   // Helper function to simulate the decrypting and decoding process in the
   // |decryptor_| with a decoding delay of kDecodingDelay buffers.
-  void DecryptAndDecodeAudio(const scoped_refptr<DecoderBuffer>& encrypted,
+  void DecryptAndDecodeAudio(scoped_refptr<DecoderBuffer> encrypted,
                              const Decryptor::AudioDecodeCB& audio_decode_cb) {
     num_decrypt_and_decode_calls_++;
     if (!encrypted->end_of_stream())