Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/browser_main_loop.h" | 5 #include "content/browser/browser_main_loop.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 #include "base/timer/hi_res_timer_manager.h" | 44 #include "base/timer/hi_res_timer_manager.h" |
| 45 #include "base/trace_event/memory_dump_manager.h" | 45 #include "base/trace_event/memory_dump_manager.h" |
| 46 #include "base/trace_event/trace_event.h" | 46 #include "base/trace_event/trace_event.h" |
| 47 #include "build/build_config.h" | 47 #include "build/build_config.h" |
| 48 #include "components/discardable_memory/service/discardable_shared_memory_manage r.h" | 48 #include "components/discardable_memory/service/discardable_shared_memory_manage r.h" |
| 49 #include "components/display_compositor/host_shared_bitmap_manager.h" | 49 #include "components/display_compositor/host_shared_bitmap_manager.h" |
| 50 #include "components/tracing/common/process_metrics_memory_dump_provider.h" | 50 #include "components/tracing/common/process_metrics_memory_dump_provider.h" |
| 51 #include "components/tracing/common/trace_config_file.h" | 51 #include "components/tracing/common/trace_config_file.h" |
| 52 #include "components/tracing/common/trace_to_console.h" | 52 #include "components/tracing/common/trace_to_console.h" |
| 53 #include "components/tracing/common/tracing_switches.h" | 53 #include "components/tracing/common/tracing_switches.h" |
| 54 #include "content/browser/audio_manager_thread.h" | |
| 55 #include "content/browser/browser_thread_impl.h" | 54 #include "content/browser/browser_thread_impl.h" |
| 56 #include "content/browser/dom_storage/dom_storage_area.h" | 55 #include "content/browser/dom_storage/dom_storage_area.h" |
| 57 #include "content/browser/download/download_resource_handler.h" | 56 #include "content/browser/download/download_resource_handler.h" |
| 58 #include "content/browser/download/save_file_manager.h" | 57 #include "content/browser/download/save_file_manager.h" |
| 59 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 58 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
| 60 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 59 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
| 61 #include "content/browser/gpu/compositor_util.h" | 60 #include "content/browser/gpu/compositor_util.h" |
| 62 #include "content/browser/gpu/gpu_data_manager_impl.h" | 61 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 63 #include "content/browser/gpu/gpu_process_host.h" | 62 #include "content/browser/gpu/gpu_process_host.h" |
| 64 #include "content/browser/gpu/shader_cache_factory.h" | 63 #include "content/browser/gpu/shader_cache_factory.h" |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 84 #include "content/public/browser/gpu_data_manager_observer.h" | 83 #include "content/public/browser/gpu_data_manager_observer.h" |
| 85 #include "content/public/browser/render_process_host.h" | 84 #include "content/public/browser/render_process_host.h" |
| 86 #include "content/public/browser/tracing_controller.h" | 85 #include "content/public/browser/tracing_controller.h" |
| 87 #include "content/public/common/content_client.h" | 86 #include "content/public/common/content_client.h" |
| 88 #include "content/public/common/content_features.h" | 87 #include "content/public/common/content_features.h" |
| 89 #include "content/public/common/content_switches.h" | 88 #include "content/public/common/content_switches.h" |
| 90 #include "content/public/common/main_function_params.h" | 89 #include "content/public/common/main_function_params.h" |
| 91 #include "content/public/common/result_codes.h" | 90 #include "content/public/common/result_codes.h" |
| 92 #include "device/gamepad/gamepad_service.h" | 91 #include "device/gamepad/gamepad_service.h" |
| 93 #include "gpu/vulkan/features.h" | 92 #include "gpu/vulkan/features.h" |
| 93 #include "media/audio/audio_manager.h" | |
| 94 #include "media/audio/audio_system_impl.h" | 94 #include "media/audio/audio_system_impl.h" |
| 95 #include "media/audio/audio_thread_impl.h" | |
| 95 #include "media/base/media.h" | 96 #include "media/base/media.h" |
| 96 #include "media/base/user_input_monitor.h" | 97 #include "media/base/user_input_monitor.h" |
| 97 #include "media/midi/midi_service.h" | 98 #include "media/midi/midi_service.h" |
| 98 #include "mojo/edk/embedder/embedder.h" | 99 #include "mojo/edk/embedder/embedder.h" |
| 99 #include "mojo/edk/embedder/scoped_ipc_support.h" | 100 #include "mojo/edk/embedder/scoped_ipc_support.h" |
| 100 #include "net/base/network_change_notifier.h" | 101 #include "net/base/network_change_notifier.h" |
| 101 #include "net/socket/client_socket_factory.h" | 102 #include "net/socket/client_socket_factory.h" |
| 102 #include "net/ssl/ssl_config_service.h" | 103 #include "net/ssl/ssl_config_service.h" |
| 103 #include "ppapi/features/features.h" | 104 #include "ppapi/features/features.h" |
| 104 #include "services/resource_coordinator/memory/coordinator/coordinator_impl.h" | 105 #include "services/resource_coordinator/memory/coordinator/coordinator_impl.h" |
| (...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1347 // Must happen after the I/O thread is shutdown since this class lives on the | 1348 // Must happen after the I/O thread is shutdown since this class lives on the |
| 1348 // I/O thread and isn't threadsafe. | 1349 // I/O thread and isn't threadsafe. |
| 1349 { | 1350 { |
| 1350 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GamepadService"); | 1351 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GamepadService"); |
| 1351 device::GamepadService::GetInstance()->Terminate(); | 1352 device::GamepadService::GetInstance()->Terminate(); |
| 1352 } | 1353 } |
| 1353 { | 1354 { |
| 1354 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:DeleteDataSources"); | 1355 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:DeleteDataSources"); |
| 1355 URLDataManager::DeleteDataSources(); | 1356 URLDataManager::DeleteDataSources(); |
| 1356 } | 1357 } |
| 1358 { | |
| 1359 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:AudioMan"); | |
| 1360 DestroyAudioManager(); | |
| 1361 } | |
| 1357 | 1362 |
| 1358 if (parts_) { | 1363 if (parts_) { |
| 1359 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:PostDestroyThreads"); | 1364 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:PostDestroyThreads"); |
| 1360 parts_->PostDestroyThreads(); | 1365 parts_->PostDestroyThreads(); |
| 1361 } | 1366 } |
| 1362 } | 1367 } |
| 1363 | 1368 |
| 1364 void BrowserMainLoop::StopStartupTracingTimer() { | 1369 void BrowserMainLoop::StopStartupTracingTimer() { |
| 1365 startup_trace_timer_.Stop(); | 1370 startup_trace_timer_.Stop(); |
| 1366 } | 1371 } |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1737 DCHECK(is_tracing_startup_for_duration_); | 1742 DCHECK(is_tracing_startup_for_duration_); |
| 1738 | 1743 |
| 1739 is_tracing_startup_for_duration_ = false; | 1744 is_tracing_startup_for_duration_ = false; |
| 1740 TracingController::GetInstance()->StopTracing( | 1745 TracingController::GetInstance()->StopTracing( |
| 1741 TracingController::CreateFileSink( | 1746 TracingController::CreateFileSink( |
| 1742 startup_trace_file_, | 1747 startup_trace_file_, |
| 1743 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); | 1748 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); |
| 1744 } | 1749 } |
| 1745 | 1750 |
| 1746 void BrowserMainLoop::CreateAudioManager() { | 1751 void BrowserMainLoop::CreateAudioManager() { |
| 1747 DCHECK(!audio_thread_); | |
| 1748 DCHECK(!audio_manager_); | 1752 DCHECK(!audio_manager_); |
| 1749 | 1753 |
| 1750 audio_manager_ = GetContentClient()->browser()->CreateAudioManager( | 1754 audio_manager_ = GetContentClient()->browser()->CreateAudioManager( |
| 1751 MediaInternals::GetInstance()); | 1755 MediaInternals::GetInstance()); |
| 1752 if (!audio_manager_) { | 1756 if (!audio_manager_) { |
| 1753 audio_thread_ = base::MakeUnique<AudioManagerThread>(); | |
| 1754 audio_manager_ = media::AudioManager::Create( | 1757 audio_manager_ = media::AudioManager::Create( |
| 1755 audio_thread_->task_runner(), audio_thread_->worker_task_runner(), | 1758 base::MakeUnique<media::AudioThreadImpl>(), |
| 1756 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), | 1759 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), |
| 1757 MediaInternals::GetInstance()); | 1760 MediaInternals::GetInstance()); |
| 1758 } | 1761 } |
| 1759 CHECK(audio_manager_); | 1762 CHECK(audio_manager_); |
| 1760 | 1763 |
| 1761 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); | 1764 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); |
| 1762 CHECK(audio_system_); | 1765 CHECK(audio_system_); |
| 1763 } | 1766 } |
| 1764 | 1767 |
| 1768 void BrowserMainLoop::DestroyAudioManager() { | |
| 1769 DCHECK(audio_manager_); | |
| 1770 | |
| 1771 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.
| |
| 1772 | |
| 1773 audio_manager_->Shutdown(); | |
| 1774 audio_manager_.reset(); | |
| 1775 } | |
| 1776 | |
| 1765 } // namespace content | 1777 } // namespace content |
| OLD | NEW |