| 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;
|
|
|