Index: content/browser/browser_main_loop.cc |
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc |
index b024d9fc7fee9e5b5d2526a2c8c5017db6a3d118..c5730ea8a3d3869f85b66d99b9bdf32d0737be78 100644 |
--- a/content/browser/browser_main_loop.cc |
+++ b/content/browser/browser_main_loop.cc |
@@ -51,7 +51,6 @@ |
#include "components/tracing/common/trace_config_file.h" |
#include "components/tracing/common/trace_to_console.h" |
#include "components/tracing/common/tracing_switches.h" |
-#include "content/browser/audio_manager_thread.h" |
#include "content/browser/browser_thread_impl.h" |
#include "content/browser/dom_storage/dom_storage_area.h" |
#include "content/browser/download/download_resource_handler.h" |
@@ -91,7 +90,9 @@ |
#include "content/public/common/result_codes.h" |
#include "device/gamepad/gamepad_service.h" |
#include "gpu/vulkan/features.h" |
+#include "media/audio/audio_manager.h" |
#include "media/audio/audio_system_impl.h" |
+#include "media/audio/audio_thread_impl.h" |
#include "media/base/media.h" |
#include "media/base/user_input_monitor.h" |
#include "media/midi/midi_service.h" |
@@ -1354,6 +1355,10 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() { |
TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:DeleteDataSources"); |
URLDataManager::DeleteDataSources(); |
} |
+ { |
+ TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:AudioMan"); |
+ DestroyAudioManager(); |
+ } |
if (parts_) { |
TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:PostDestroyThreads"); |
@@ -1744,15 +1749,13 @@ void BrowserMainLoop::EndStartupTracing() { |
} |
void BrowserMainLoop::CreateAudioManager() { |
- DCHECK(!audio_thread_); |
DCHECK(!audio_manager_); |
audio_manager_ = GetContentClient()->browser()->CreateAudioManager( |
MediaInternals::GetInstance()); |
if (!audio_manager_) { |
- audio_thread_ = base::MakeUnique<AudioManagerThread>(); |
audio_manager_ = media::AudioManager::Create( |
- audio_thread_->task_runner(), audio_thread_->worker_task_runner(), |
+ base::MakeUnique<media::AudioThreadImpl>(), |
BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), |
MediaInternals::GetInstance()); |
} |
@@ -1762,4 +1765,13 @@ void BrowserMainLoop::CreateAudioManager() { |
CHECK(audio_system_); |
} |
+void BrowserMainLoop::DestroyAudioManager() { |
+ DCHECK(audio_manager_); |
+ |
+ audio_system_.reset(); |
o1ka
2017/04/28 13:24:19
Audio thread can have AudioSystem operations poste
alokp
2017/04/28 17:31:12
Good catch. IMO we should just shutdown the AM her
o1ka
2017/05/02 16:16:00
sgtm
alokp
2017/05/09 19:06:15
Done.
|
+ |
+ audio_manager_->Shutdown(); |
+ audio_manager_.reset(); |
+} |
+ |
} // namespace content |