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

Side by Side Diff: content/browser/browser_main_loop.cc

Issue 2784433002: Ensures that audio tasks cannot run after AudioManager is deleted. (Closed)
Patch Set: rebase 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 unified diff | Download patch
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "base/timer/hi_res_timer_manager.h" 45 #include "base/timer/hi_res_timer_manager.h"
46 #include "base/trace_event/memory_dump_manager.h" 46 #include "base/trace_event/memory_dump_manager.h"
47 #include "base/trace_event/trace_event.h" 47 #include "base/trace_event/trace_event.h"
48 #include "build/build_config.h" 48 #include "build/build_config.h"
49 #include "components/discardable_memory/service/discardable_shared_memory_manage r.h" 49 #include "components/discardable_memory/service/discardable_shared_memory_manage r.h"
50 #include "components/display_compositor/host_shared_bitmap_manager.h" 50 #include "components/display_compositor/host_shared_bitmap_manager.h"
51 #include "components/tracing/common/process_metrics_memory_dump_provider.h" 51 #include "components/tracing/common/process_metrics_memory_dump_provider.h"
52 #include "components/tracing/common/trace_config_file.h" 52 #include "components/tracing/common/trace_config_file.h"
53 #include "components/tracing/common/trace_to_console.h" 53 #include "components/tracing/common/trace_to_console.h"
54 #include "components/tracing/common/tracing_switches.h" 54 #include "components/tracing/common/tracing_switches.h"
55 #include "content/browser/audio_manager_thread.h"
56 #include "content/browser/browser_thread_impl.h" 55 #include "content/browser/browser_thread_impl.h"
57 #include "content/browser/dom_storage/dom_storage_area.h" 56 #include "content/browser/dom_storage/dom_storage_area.h"
58 #include "content/browser/download/download_resource_handler.h" 57 #include "content/browser/download/download_resource_handler.h"
59 #include "content/browser/download/save_file_manager.h" 58 #include "content/browser/download/save_file_manager.h"
60 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" 59 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
61 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" 60 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
62 #include "content/browser/gpu/compositor_util.h" 61 #include "content/browser/gpu/compositor_util.h"
63 #include "content/browser/gpu/gpu_data_manager_impl.h" 62 #include "content/browser/gpu/gpu_data_manager_impl.h"
64 #include "content/browser/gpu/gpu_process_host.h" 63 #include "content/browser/gpu/gpu_process_host.h"
65 #include "content/browser/gpu/shader_cache_factory.h" 64 #include "content/browser/gpu/shader_cache_factory.h"
(...skipping 20 matching lines...) Expand all
86 #include "content/public/browser/gpu_data_manager_observer.h" 85 #include "content/public/browser/gpu_data_manager_observer.h"
87 #include "content/public/browser/render_process_host.h" 86 #include "content/public/browser/render_process_host.h"
88 #include "content/public/browser/tracing_controller.h" 87 #include "content/public/browser/tracing_controller.h"
89 #include "content/public/common/content_client.h" 88 #include "content/public/common/content_client.h"
90 #include "content/public/common/content_features.h" 89 #include "content/public/common/content_features.h"
91 #include "content/public/common/content_switches.h" 90 #include "content/public/common/content_switches.h"
92 #include "content/public/common/main_function_params.h" 91 #include "content/public/common/main_function_params.h"
93 #include "content/public/common/result_codes.h" 92 #include "content/public/common/result_codes.h"
94 #include "device/gamepad/gamepad_service.h" 93 #include "device/gamepad/gamepad_service.h"
95 #include "gpu/vulkan/features.h" 94 #include "gpu/vulkan/features.h"
95 #include "media/audio/audio_manager.h"
96 #include "media/audio/audio_system_impl.h" 96 #include "media/audio/audio_system_impl.h"
97 #include "media/audio/audio_thread_impl.h"
97 #include "media/base/media.h" 98 #include "media/base/media.h"
98 #include "media/base/user_input_monitor.h" 99 #include "media/base/user_input_monitor.h"
99 #include "media/midi/midi_service.h" 100 #include "media/midi/midi_service.h"
100 #include "mojo/edk/embedder/embedder.h" 101 #include "mojo/edk/embedder/embedder.h"
101 #include "mojo/edk/embedder/scoped_ipc_support.h" 102 #include "mojo/edk/embedder/scoped_ipc_support.h"
102 #include "net/base/network_change_notifier.h" 103 #include "net/base/network_change_notifier.h"
103 #include "net/socket/client_socket_factory.h" 104 #include "net/socket/client_socket_factory.h"
104 #include "net/ssl/ssl_config_service.h" 105 #include "net/ssl/ssl_config_service.h"
105 #include "ppapi/features/features.h" 106 #include "ppapi/features/features.h"
106 #include "services/resource_coordinator/memory/coordinator/coordinator_impl.h" 107 #include "services/resource_coordinator/memory/coordinator/coordinator_impl.h"
(...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 // Must happen after the I/O thread is shutdown since this class lives on the 1360 // Must happen after the I/O thread is shutdown since this class lives on the
1360 // I/O thread and isn't threadsafe. 1361 // I/O thread and isn't threadsafe.
1361 { 1362 {
1362 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GamepadService"); 1363 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GamepadService");
1363 device::GamepadService::GetInstance()->Terminate(); 1364 device::GamepadService::GetInstance()->Terminate();
1364 } 1365 }
1365 { 1366 {
1366 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:DeleteDataSources"); 1367 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:DeleteDataSources");
1367 URLDataManager::DeleteDataSources(); 1368 URLDataManager::DeleteDataSources();
1368 } 1369 }
1370 {
1371 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:AudioMan");
1372 audio_manager_->Shutdown();
1373 }
1369 1374
1370 if (parts_) { 1375 if (parts_) {
1371 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:PostDestroyThreads"); 1376 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:PostDestroyThreads");
1372 parts_->PostDestroyThreads(); 1377 parts_->PostDestroyThreads();
1373 } 1378 }
1374 } 1379 }
1375 1380
1376 void BrowserMainLoop::StopStartupTracingTimer() { 1381 void BrowserMainLoop::StopStartupTracingTimer() {
1377 startup_trace_timer_.Stop(); 1382 startup_trace_timer_.Stop();
1378 } 1383 }
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1753 DCHECK(is_tracing_startup_for_duration_); 1758 DCHECK(is_tracing_startup_for_duration_);
1754 1759
1755 is_tracing_startup_for_duration_ = false; 1760 is_tracing_startup_for_duration_ = false;
1756 TracingController::GetInstance()->StopTracing( 1761 TracingController::GetInstance()->StopTracing(
1757 TracingController::CreateFileSink( 1762 TracingController::CreateFileSink(
1758 startup_trace_file_, 1763 startup_trace_file_,
1759 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); 1764 base::Bind(OnStoppedStartupTracing, startup_trace_file_)));
1760 } 1765 }
1761 1766
1762 void BrowserMainLoop::CreateAudioManager() { 1767 void BrowserMainLoop::CreateAudioManager() {
1763 DCHECK(!audio_thread_);
1764 DCHECK(!audio_manager_); 1768 DCHECK(!audio_manager_);
1765 1769
1766 audio_manager_ = GetContentClient()->browser()->CreateAudioManager( 1770 audio_manager_ = GetContentClient()->browser()->CreateAudioManager(
1767 MediaInternals::GetInstance()); 1771 MediaInternals::GetInstance());
1768 if (!audio_manager_) { 1772 if (!audio_manager_) {
1769 audio_thread_ = base::MakeUnique<AudioManagerThread>();
1770 audio_manager_ = media::AudioManager::Create( 1773 audio_manager_ = media::AudioManager::Create(
1771 audio_thread_->task_runner(), audio_thread_->worker_task_runner(), 1774 base::MakeUnique<media::AudioThreadImpl>(),
1772 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), 1775 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE),
1773 MediaInternals::GetInstance()); 1776 MediaInternals::GetInstance());
1774 } 1777 }
1775 CHECK(audio_manager_); 1778 CHECK(audio_manager_);
1776 1779
1777 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); 1780 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get());
1778 CHECK(audio_system_); 1781 CHECK(audio_system_);
1779 } 1782 }
1780 1783
1781 } // namespace content 1784 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_main_loop.h ('k') | content/browser/renderer_host/media/audio_input_device_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698