diff options
author | acolwell@chromium.org <acolwell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-23 03:38:13 +0000 |
---|---|---|
committer | acolwell@chromium.org <acolwell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-23 03:38:13 +0000 |
commit | f340282075194fc5d75e64c500ae6593c3792d8d (patch) | |
tree | efb645b3059e6d4aa059db2d98da8598dfb50936 /media/audio/audio_manager.cc | |
parent | 778f0ee11c9b391ac76fff4ab04bd4f13fbc23d9 (diff) | |
download | chromium_src-f340282075194fc5d75e64c500ae6593c3792d8d.zip chromium_src-f340282075194fc5d75e64c500ae6593c3792d8d.tar.gz chromium_src-f340282075194fc5d75e64c500ae6593c3792d8d.tar.bz2 |
Fix AudioManager shutdown
This patch makes sure the audio thread is stopped before
the AudioManager is destroyed. Under heavy load it is
possible to have tasks still on the audio thread's message
loop when the audio manager is destroyed. These were
getting called when the Thread object is destroyed which
happens after all of the AudioManager destructors are
called. The new Cleanup() method stops the thread before
any destruction occurs.
BUG=67804
TEST=none
Review URL: http://codereview.chromium.org/6026011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70034 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/audio_manager.cc')
-rw-r--r-- | media/audio/audio_manager.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/media/audio/audio_manager.cc b/media/audio/audio_manager.cc index 3abd010..bc91c63 100644 --- a/media/audio/audio_manager.cc +++ b/media/audio/audio_manager.cc @@ -9,6 +9,7 @@ namespace { +bool g_destroy_called = false; AudioManager* g_audio_manager = NULL; // NullAudioManager is the audio manager used on the systems that have no @@ -40,13 +41,18 @@ class NullAudioManager : public AudioManager { // static void AudioManager::Destroy(void* not_used) { - delete g_audio_manager; + g_destroy_called = true; + + g_audio_manager->Cleanup(); + + AudioManager* audio_manager = g_audio_manager; g_audio_manager = NULL; + delete audio_manager; } // static AudioManager* AudioManager::GetAudioManager() { - if (!g_audio_manager) { + if (!g_audio_manager && !g_destroy_called) { g_audio_manager = CreateAudioManager(); g_audio_manager->Init(); base::AtExitManager::RegisterCallback(&AudioManager::Destroy, NULL); |