Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1377)

Unified Diff: media/mojo/services/test_mojo_media_client.cc

Issue 2886683003: media: Shutdown AudioManager in TestMojoMediaClient (Closed)
Patch Set: more fix Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mojo/services/test_mojo_media_client.cc
diff --git a/media/mojo/services/test_mojo_media_client.cc b/media/mojo/services/test_mojo_media_client.cc
index 1e380c1f527a177b74c422fde8c908d18d16a680..ba03112920f93081c98990f0701c94f6139dedd2 100644
--- a/media/mojo/services/test_mojo_media_client.cc
+++ b/media/mojo/services/test_mojo_media_client.cc
@@ -27,11 +27,15 @@ TestMojoMediaClient::TestMojoMediaClient() {}
TestMojoMediaClient::~TestMojoMediaClient() {
DVLOG(1) << __func__;
- // AudioManager destructor requires MessageLoop.
- // Destroy it before the message loop goes away.
- audio_manager_.reset();
- // Flush the message loop to ensure that the audio manager is destroyed.
- base::RunLoop().RunUntilIdle();
+
+ if (audio_manager_) {
+ audio_manager_->Shutdown();
+ // AudioManager destructor requires MessageLoop.
alokp 2017/05/16 16:52:26 You do not need to manually reset and flush the me
xhwang 2017/05/16 16:56:09 Done.
+ // Destroy it before the message loop goes away.
+ audio_manager_.reset();
+ // Flush the message loop to ensure that the audio manager is destroyed.
+ base::RunLoop().RunUntilIdle();
+ }
}
void TestMojoMediaClient::Initialize(
@@ -44,7 +48,6 @@ void TestMojoMediaClient::Initialize(
if (!audio_manager) {
audio_manager_ = media::AudioManager::CreateForTesting(
base::MakeUnique<AudioThreadImpl>());
- audio_manager = audio_manager_.get();
// Flush the message loop to ensure that the audio manager is initialized.
base::RunLoop().RunUntilIdle();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698