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

Unified Diff: media/audio/pulse/audio_manager_pulse.cc

Issue 2784433002: Ensures that audio tasks cannot run after AudioManager is deleted. (Closed)
Patch Set: chromeos and android build Created 3 years, 8 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
Index: media/audio/pulse/audio_manager_pulse.cc
diff --git a/media/audio/pulse/audio_manager_pulse.cc b/media/audio/pulse/audio_manager_pulse.cc
index 779bf92e58d3d39c981f398cf911ed504bc2191f..28511e839864150ccd3b1482e57c49a99203b74f 100644
--- a/media/audio/pulse/audio_manager_pulse.cc
+++ b/media/audio/pulse/audio_manager_pulse.cc
@@ -48,13 +48,9 @@ static const base::FilePath::CharType kPulseLib[] =
FILE_PATH_LITERAL("libpulse.so.0");
#endif
-AudioManagerPulse::AudioManagerPulse(
- scoped_refptr<base::SingleThreadTaskRunner> task_runner,
- scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner,
- AudioLogFactory* audio_log_factory)
- : AudioManagerBase(std::move(task_runner),
- std::move(worker_task_runner),
- audio_log_factory),
+AudioManagerPulse::AudioManagerPulse(std::unique_ptr<AudioThread> audio_thread,
+ AudioLogFactory* audio_log_factory)
+ : AudioManagerBase(std::move(audio_thread), audio_log_factory),
input_mainloop_(NULL),
input_context_(NULL),
devices_(NULL),
@@ -63,12 +59,7 @@ AudioManagerPulse::AudioManagerPulse(
SetMaxOutputStreamsAllowed(kMaxOutputStreams);
}
-AudioManagerPulse::~AudioManagerPulse() {
- Shutdown();
- // The Pulse objects are the last things to be destroyed since Shutdown()
- // needs them.
- DestroyPulse();
-}
+AudioManagerPulse::~AudioManagerPulse() = default;
bool AudioManagerPulse::Init() {
// TODO(alokp): Investigate if InitPulse can happen on the audio thread.
@@ -79,7 +70,13 @@ bool AudioManagerPulse::Init() {
return InitPulse();
}
-// Implementation of AudioManager.
+void AudioManagerPulse::ShutdownOnAudioThread() {
+ AudioManagerBase::ShutdownOnAudioThread();
+ // The Pulse objects are the last things to be destroyed since Shutdown()
+ // needs them.
+ DestroyPulse();
+}
+
bool AudioManagerPulse::HasAudioOutputDevices() {
AudioDeviceNames devices;
GetAudioOutputDeviceNames(&devices);

Powered by Google App Engine
This is Rietveld 408576698