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

Unified Diff: media/audio/audio_system_impl.cc

Issue 2687853002: Switching VirtualKeyboardPrivate keyboard config call stack to receive HasInputDevices() responce a… (Closed)
Patch Set: Fix for compilation error on linux_chromium_chromeos Created 3 years, 10 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_system_impl.h ('k') | media/audio/audio_system_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_system_impl.cc
diff --git a/media/audio/audio_system_impl.cc b/media/audio/audio_system_impl.cc
index 96300ba950df9e3c3cef1f2acd9ac369fd0b1be6..fdffa70fda0f70cbce1e60457eb2044e9287a254 100644
--- a/media/audio/audio_system_impl.cc
+++ b/media/audio/audio_system_impl.cc
@@ -33,9 +33,12 @@ AudioParameters GetInputParametersOnDeviceThread(AudioManager* audio_manager,
AudioSystemImpl::AudioSystemImpl(AudioManager* audio_manager)
: audio_manager_(audio_manager) {
DCHECK(audio_manager_);
+ AudioSystem::SetInstance(this);
}
-AudioSystemImpl::~AudioSystemImpl() {}
+AudioSystemImpl::~AudioSystemImpl() {
+ AudioSystem::ClearInstance(this);
+}
// static
std::unique_ptr<AudioSystem> AudioSystemImpl::Create(
@@ -59,6 +62,20 @@ void AudioSystemImpl::GetInputStreamParameters(
std::move(on_params_cb));
}
+void AudioSystemImpl::HasInputDevices(OnBoolCallback on_has_devices_cb) const {
+ if (GetTaskRunner()->BelongsToCurrentThread()) {
tommi (sloooow) - chröme 2017/02/09 16:39:34 I guess this is necessary so that the on_has_devic
o1ka 2017/02/09 16:56:10 It's never called on the audio thread unless it is
tommi (sloooow) - chröme 2017/02/10 10:51:07 Thanks - now looking at this again, I see I misre
+ GetTaskRunner()->PostTask(
+ FROM_HERE,
+ base::Bind(on_has_devices_cb, audio_manager_->HasAudioInputDevices()));
+ return;
+ }
+ base::PostTaskAndReplyWithResult(
+ GetTaskRunner(), FROM_HERE,
+ base::Bind(&AudioManager::HasAudioInputDevices,
+ base::Unretained(audio_manager_)),
+ std::move(on_has_devices_cb));
+}
+
AudioManager* AudioSystemImpl::GetAudioManager() const {
return audio_manager_;
}
« no previous file with comments | « media/audio/audio_system_impl.h ('k') | media/audio/audio_system_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698