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

Unified Diff: media/audio/audio_manager_base.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/audio/audio_manager_base.h ('k') | media/audio/audio_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_manager_base.cc
diff --git a/media/audio/audio_manager_base.cc b/media/audio/audio_manager_base.cc
index e149216e02de6e049fe778868a75e805f3e4f877..65399cd632f03e2d7963185df2c6125eb7e84a03 100644
--- a/media/audio/audio_manager_base.cc
+++ b/media/audio/audio_manager_base.cc
@@ -84,11 +84,9 @@ class AudioManagerBase::CompareByParams {
const DispatcherParams* dispatcher_;
};
-AudioManagerBase::AudioManagerBase(
- scoped_refptr<base::SingleThreadTaskRunner> task_runner,
- scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner,
- AudioLogFactory* audio_log_factory)
- : AudioManager(std::move(task_runner), std::move(worker_task_runner)),
+AudioManagerBase::AudioManagerBase(std::unique_ptr<AudioThread> audio_thread,
+ AudioLogFactory* audio_log_factory)
+ : AudioManager(std::move(audio_thread)),
max_num_output_streams_(kDefaultMaxOutputStreams),
max_num_input_streams_(kDefaultMaxInputStreams),
num_output_streams_(0),
@@ -99,8 +97,6 @@ AudioManagerBase::AudioManagerBase(
audio_log_factory_(audio_log_factory) {}
AudioManagerBase::~AudioManagerBase() {
- DCHECK(GetTaskRunner()->BelongsToCurrentThread());
-
// All the output streams should have been deleted.
CHECK_EQ(0, num_output_streams_);
// All the input streams should have been deleted.
@@ -292,7 +288,7 @@ AudioOutputStream* AudioManagerBase::MakeAudioOutputStreamProxy(
std::unique_ptr<AudioOutputDispatcher> dispatcher;
if (output_params.format() != AudioParameters::AUDIO_FAKE) {
// Using unretained for |debug_recording_manager_| is safe since it
- // outlives the dispatchers (cleared in Shutdown()).
+ // outlives the dispatchers (cleared in ShutdownOnAudioThread()).
dispatcher = base::MakeUnique<AudioOutputResampler>(
this, params, output_params, output_device_id, kCloseDelay,
debug_recording_manager_
@@ -341,7 +337,7 @@ void AudioManagerBase::ReleaseInputStream(AudioInputStream* stream) {
delete stream;
}
-void AudioManagerBase::Shutdown() {
+void AudioManagerBase::ShutdownOnAudioThread() {
DCHECK(GetTaskRunner()->BelongsToCurrentThread());
// Close all output streams.
« no previous file with comments | « media/audio/audio_manager_base.h ('k') | media/audio/audio_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698