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

Unified Diff: media/audio/mock_audio_manager.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/mock_audio_manager.h ('k') | media/audio/pulse/audio_manager_pulse.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/mock_audio_manager.cc
diff --git a/media/audio/mock_audio_manager.cc b/media/audio/mock_audio_manager.cc
index b6c09e0d7077c5826c1dc180c2ae9863ac3f9440..af1c643b2a0337aba3e5c6bde8350649e0f7a06b 100644
--- a/media/audio/mock_audio_manager.cc
+++ b/media/audio/mock_audio_manager.cc
@@ -11,26 +11,14 @@
namespace media {
-void MockAudioManager::Deleter::operator()(
- const MockAudioManager* instance) const {
- CHECK(instance);
- if (instance->GetTaskRunner()->BelongsToCurrentThread()) {
- delete instance;
- return;
- }
- // AudioManager must be destroyed on the audio thread.
- if (!instance->GetTaskRunner()->DeleteSoon(FROM_HERE, instance)) {
- LOG(WARNING) << "Failed to delete AudioManager instance.";
- }
-}
-
-MockAudioManager::MockAudioManager(
- scoped_refptr<base::SingleThreadTaskRunner> task_runner)
- : AudioManager(task_runner, task_runner) {}
+MockAudioManager::MockAudioManager(std::unique_ptr<AudioThread> audio_thread)
+ : AudioManager(std::move(audio_thread)) {}
MockAudioManager::~MockAudioManager() {
}
+void MockAudioManager::ShutdownOnAudioThread() {}
+
bool MockAudioManager::HasAudioOutputDevices() {
DCHECK(GetTaskRunner()->BelongsToCurrentThread());
return has_output_devices_;
« no previous file with comments | « media/audio/mock_audio_manager.h ('k') | media/audio/pulse/audio_manager_pulse.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698