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

Unified Diff: media/audio/audio_manager.cc

Issue 2763383002: Switching AudioInputDeviceManager from using AudioManager interface to AudioSystem one. (Closed)
Patch Set: rebase 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
« no previous file with comments | « content/browser/speech/speech_recognizer_impl_unittest.cc ('k') | media/audio/audio_system.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_manager.cc
diff --git a/media/audio/audio_manager.cc b/media/audio/audio_manager.cc
index 4b98e36910f500ecd31402fcf2a7ffec1a277a74..9fb92703ee4dc4f97ee42530fcba54c1dd4bef75 100644
--- a/media/audio/audio_manager.cc
+++ b/media/audio/audio_manager.cc
@@ -254,21 +254,19 @@ void AudioManagerDeleter::operator()(const AudioManager* instance) const {
LOG(WARNING) << "Multiple instances of AudioManager detected";
}
-#if defined(OS_MACOSX)
- // If we are on Mac, tasks after this point are not executed, hence this is
- // the only chance to delete the audio manager (which on Mac lives on the
- // main browser thread instead of a dedicated audio thread). If we don't
- // delete here, the CoreAudio thread can keep providing callbacks, which
- // uses a state that is destroyed in ~BrowserMainLoop().
- // See http://crbug.com/623703 for more details.
- DCHECK(instance->GetTaskRunner()->BelongsToCurrentThread());
- delete instance;
-#else
- // AudioManager must be destroyed on the audio thread.
- if (!instance->GetTaskRunner()->DeleteSoon(FROM_HERE, instance)) {
- LOG(WARNING) << "Failed to delete AudioManager instance.";
+ // The deleter runs on the main thread, and AudioManager must be destroyed on
+ // the audio thread. If the audio thread is the same as the main one, tasks
+ // after this point are not executed, hence this is the only chance to delete
+ // AudioManager. See http://crbug.com/623703 for more details.
+ if (instance->GetTaskRunner()->BelongsToCurrentThread()) {
+ delete instance;
+ return;
}
-#endif
+
+ // AudioManager must be destroyed on the audio thread. See
+ // http://crbug.com/705455 for an existing AudioManager lifetime issue.
+ if (!instance->GetTaskRunner()->DeleteSoon(FROM_HERE, instance))
+ LOG(WARNING) << "Failed to delete AudioManager instance.";
}
// Forward declaration of the platform specific AudioManager factory function.
« no previous file with comments | « content/browser/speech/speech_recognizer_impl_unittest.cc ('k') | media/audio/audio_system.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698