[go: nahoru, domu]

Remove calls to deprecated MessageLoop methods in media.

This CL makes the following replacements in
media:

Before               After
----------------------------------------------------------
 x.PostTask()          x.task_runner()->PostTask()
   PostDelayedTask()                    PostDelayedTask()
   ReleaseSoon()                        ReleaseSoon()
   DeleteSoon()                         DeleteSoon()
x->PostTask()         y->task_runner()->PostTask()
   PostDelayedTask()                    PostDelayedTask()
   ReleaseSoon()                        ReleaseSoon()
   DeleteSoon()                         DeleteSoon()

 x.Run()              RunLoop().Run()
 x.RunUntilIdle()     RunLoop().RunUntilIdle()

x->Run()              RunLoop().Run()
x->RunUntilIdle()     RunLoop().RunUntilIdle()
    If |y| isn't MessageLoopForUI::current() or
    MessageLoopForIO::current()

 y.message_loop()->task_runner()
                      y.task_runner()
y->message_loop()->task_runner()
                      y->task_runner()
----------------------------------------------------------

|x| is a base::MessageLoop(ForUI|ForIO) or a pointer to
a base::MessageLoop(ForUI|ForIO). |y| is a base::Thread
or a pointer to a base::Thread.

This CL was generated using the MessageLoopDeprecatedMethods
clang-tidy fix available on the associated bug. Only files
that compile on Mac are affected. Follow-up CLs will make
these replacements for other platforms.

This CL doesn't change code behavior.

BUG=616447
R=chcunningham@chromium.org

Review-Url: https://codereview.chromium.org/2086353002
Cr-Commit-Position: refs/heads/master@{#402209}
diff --git a/media/filters/decrypting_audio_decoder_unittest.cc b/media/filters/decrypting_audio_decoder_unittest.cc
index 4b9784e..fe7f976c 100644
--- a/media/filters/decrypting_audio_decoder_unittest.cc
+++ b/media/filters/decrypting_audio_decoder_unittest.cc
@@ -11,6 +11,7 @@
 #include "base/callback_helpers.h"
 #include "base/macros.h"
 #include "base/message_loop/message_loop.h"
+#include "base/run_loop.h"
 #include "media/base/audio_buffer.h"
 #include "media/base/decoder_buffer.h"
 #include "media/base/decrypt_config.h"
@@ -99,7 +100,7 @@
     decoder_->Initialize(config, cdm_context_.get(), NewExpectedBoolCB(success),
                          base::Bind(&DecryptingAudioDecoderTest::FrameReady,
                                     base::Unretained(this)));
-    message_loop_.RunUntilIdle();
+    base::RunLoop().RunUntilIdle();
   }
 
   enum CdmType { CDM_WITHOUT_DECRYPTOR, CDM_WITH_DECRYPTOR };
@@ -146,7 +147,7 @@
     decoder_->Decode(buffer,
                      base::Bind(&DecryptingAudioDecoderTest::DecodeDone,
                                 base::Unretained(this)));
-    message_loop_.RunUntilIdle();
+    base::RunLoop().RunUntilIdle();
   }
 
   // Helper function to simulate the decrypting and decoding process in the
@@ -198,7 +199,7 @@
     decoder_->Decode(encrypted_buffer_,
                      base::Bind(&DecryptingAudioDecoderTest::DecodeDone,
                                 base::Unretained(this)));
-    message_loop_.RunUntilIdle();
+    base::RunLoop().RunUntilIdle();
     // Make sure the Decode() on the decoder triggers a DecryptAndDecode() on
     // the decryptor.
     EXPECT_FALSE(pending_audio_decode_cb_.is_null());
@@ -212,7 +213,7 @@
     decoder_->Decode(encrypted_buffer_,
                      base::Bind(&DecryptingAudioDecoderTest::DecodeDone,
                                 base::Unretained(this)));
-    message_loop_.RunUntilIdle();
+    base::RunLoop().RunUntilIdle();
   }
 
   void AbortPendingAudioDecodeCB() {
@@ -238,7 +239,7 @@
             this, &DecryptingAudioDecoderTest::AbortPendingAudioDecodeCB));
 
     decoder_->Reset(NewExpectedClosure());
-    message_loop_.RunUntilIdle();
+    base::RunLoop().RunUntilIdle();
   }
 
   void Destroy() {
@@ -247,7 +248,7 @@
             this, &DecryptingAudioDecoderTest::AbortAllPendingCBs));
 
     decoder_.reset();
-    message_loop_.RunUntilIdle();
+    base::RunLoop().RunUntilIdle();
   }
 
   MOCK_METHOD1(FrameReady, void(const scoped_refptr<AudioBuffer>&));
@@ -391,7 +392,7 @@
   EXPECT_NE(new_config.samples_per_second(), config_.samples_per_second());
 
   ReinitializeConfigChange(new_config);
-  message_loop_.RunUntilIdle();
+  base::RunLoop().RunUntilIdle();
 }
 
 // Test the case where the a key is added when the decryptor is in
@@ -405,7 +406,7 @@
   EXPECT_CALL(*this, FrameReady(decoded_frame_));
   EXPECT_CALL(*this, DecodeDone(DecodeStatus::OK));
   key_added_cb_.Run();
-  message_loop_.RunUntilIdle();
+  base::RunLoop().RunUntilIdle();
 }
 
 // Test the case where the a key is added when the decryptor is in
@@ -423,7 +424,7 @@
   key_added_cb_.Run();
   base::ResetAndReturn(&pending_audio_decode_cb_).Run(
       Decryptor::kNoKey, Decryptor::AudioFrames());
-  message_loop_.RunUntilIdle();
+  base::RunLoop().RunUntilIdle();
 }
 
 // Test resetting when the decoder is in kIdle state but has not decoded any