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

Unified Diff: chrome/browser/chromeos/audio/audio_mixer_alsa.cc

Issue 11358083: Decouple c/b/cros/audio from c/b/speech. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | « chrome/browser/chromeos/audio/audio_mixer_alsa.h ('k') | chrome/browser/chromeos/audio/audio_mixer_cras.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/audio/audio_mixer_alsa.cc
diff --git a/chrome/browser/chromeos/audio/audio_mixer_alsa.cc b/chrome/browser/chromeos/audio/audio_mixer_alsa.cc
index 464a4a01f4898bda9e6e82ddf6f1b27ac5703e34..7924d89b6da5f2eb87ca9d67bdeb3c5d88690173 100644
--- a/chrome/browser/chromeos/audio/audio_mixer_alsa.cc
+++ b/chrome/browser/chromeos/audio/audio_mixer_alsa.cc
@@ -13,12 +13,12 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
+#include "base/callback.h"
#include "base/chromeos/chromeos_version.h"
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/threading/thread.h"
#include "base/threading/thread_restrictions.h"
-#include "chrome/browser/speech/extension_api/tts_extension_api_chromeos.h"
#include "content/public/browser/browser_thread.h"
typedef long alsa_long_t; // 'long' is required for ALSA API calls.
@@ -104,13 +104,15 @@ AudioMixerAlsa::~AudioMixerAlsa() {
thread_.reset();
}
-void AudioMixerAlsa::Init() {
+void AudioMixerAlsa::Init(const base::Closure& on_connected) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!thread_.get()) << "Init() called twice";
thread_.reset(new base::Thread("AudioMixerAlsa"));
CHECK(thread_->Start());
thread_->message_loop()->PostTask(
- FROM_HERE, base::Bind(&AudioMixerAlsa::Connect, base::Unretained(this)));
+ FROM_HERE, base::Bind(&AudioMixerAlsa::Connect,
+ base::Unretained(this),
+ on_connected));
}
double AudioMixerAlsa::GetVolumePercent() {
@@ -190,7 +192,7 @@ void AudioMixerAlsa::SetCaptureMuteLocked(bool locked) {
is_capture_mute_locked_ = locked;
}
-void AudioMixerAlsa::Connect() {
+void AudioMixerAlsa::Connect(const base::Closure& on_connected) {
DCHECK(MessageLoop::current() == thread_->message_loop());
DCHECK(!alsa_mixer_);
@@ -201,14 +203,17 @@ void AudioMixerAlsa::Connect() {
if (!base::chromeos::IsRunningOnChromeOS())
return;
- if (!ConnectInternal()) {
- thread_->message_loop()->PostDelayedTask(FROM_HERE,
- base::Bind(&AudioMixerAlsa::Connect, base::Unretained(this)),
+ if (!ConnectInternal(on_connected)) {
+ thread_->message_loop()->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&AudioMixerAlsa::Connect,
+ base::Unretained(this),
+ on_connected),
base::TimeDelta::FromSeconds(kConnectionRetrySleepSec));
}
}
-bool AudioMixerAlsa::ConnectInternal() {
+bool AudioMixerAlsa::ConnectInternal(const base::Closure& on_connected) {
DCHECK(MessageLoop::current() == thread_->message_loop());
num_connection_attempts_++;
int err;
@@ -325,11 +330,7 @@ bool AudioMixerAlsa::ConnectInternal() {
volume_db_ = PercentToDb(initial_volume_percent_);
}
- // The speech synthesis service shouldn't be initialized until after
- // we get to this point, so we call this function to tell it that it's
- // safe to do TTS now. NotificationService would be cleaner,
- // but it's not available at this point.
- EnableChromeOsTts();
+ on_connected.Run();
ApplyState();
return true;
« no previous file with comments | « chrome/browser/chromeos/audio/audio_mixer_alsa.h ('k') | chrome/browser/chromeos/audio/audio_mixer_cras.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698