summaryrefslogtreecommitdiffstats
path: root/content/browser/speech/speech_recognition_manager_impl.cc
diff options
context:
space:
mode:
authorxhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-04 14:17:11 +0000
committerxhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-04 14:17:11 +0000
commitdd32b127ce5deac52b24f493dac79195a30bf138 (patch)
treefe41d5b0b6fb1bcff0ccfc87a9f46cefee602723 /content/browser/speech/speech_recognition_manager_impl.cc
parent63b5c710324dc630a663eb76a6a4cc1372322830 (diff)
downloadchromium_src-dd32b127ce5deac52b24f493dac79195a30bf138.zip
chromium_src-dd32b127ce5deac52b24f493dac79195a30bf138.tar.gz
chromium_src-dd32b127ce5deac52b24f493dac79195a30bf138.tar.bz2
content: Use base::MessageLoop.
BUG=236029 R=avi@chromium.org Review URL: https://chromiumcodereview.appspot.com/14335017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198316 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/speech/speech_recognition_manager_impl.cc')
-rw-r--r--content/browser/speech/speech_recognition_manager_impl.cc38
1 files changed, 27 insertions, 11 deletions
diff --git a/content/browser/speech/speech_recognition_manager_impl.cc b/content/browser/speech/speech_recognition_manager_impl.cc
index d8faf9d..ea49579 100644
--- a/content/browser/speech/speech_recognition_manager_impl.cc
+++ b/content/browser/speech/speech_recognition_manager_impl.cc
@@ -178,15 +178,21 @@ void SpeechRecognitionManagerImpl::RecognitionAllowedCallback(int session_id,
#endif // defined(OS_IOS)
if (is_allowed) {
- MessageLoop::current()->PostTask(FROM_HERE,
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
base::Bind(&SpeechRecognitionManagerImpl::DispatchEvent,
- weak_factory_.GetWeakPtr(), session_id, EVENT_START));
+ weak_factory_.GetWeakPtr(),
+ session_id,
+ EVENT_START));
} else {
OnRecognitionError(session_id, SpeechRecognitionError(
SPEECH_RECOGNITION_ERROR_NOT_ALLOWED));
- MessageLoop::current()->PostTask(FROM_HERE,
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
base::Bind(&SpeechRecognitionManagerImpl::DispatchEvent,
- weak_factory_.GetWeakPtr(), session_id, EVENT_ABORT));
+ weak_factory_.GetWeakPtr(),
+ session_id,
+ EVENT_ABORT));
}
}
@@ -225,9 +231,12 @@ void SpeechRecognitionManagerImpl::AbortSession(int session_id) {
BrowserMainLoop::GetMediaStreamManager()->CancelRequest(context.label);
#endif // !defined(OS_IOS)
- MessageLoop::current()->PostTask(FROM_HERE,
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
base::Bind(&SpeechRecognitionManagerImpl::DispatchEvent,
- weak_factory_.GetWeakPtr(), session_id, EVENT_ABORT));
+ weak_factory_.GetWeakPtr(),
+ session_id,
+ EVENT_ABORT));
}
void SpeechRecognitionManagerImpl::StopAudioCaptureForSession(int session_id) {
@@ -242,9 +251,12 @@ void SpeechRecognitionManagerImpl::StopAudioCaptureForSession(int session_id) {
BrowserMainLoop::GetMediaStreamManager()->CancelRequest(context.label);
#endif // !defined(OS_IOS)
- MessageLoop::current()->PostTask(FROM_HERE,
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
base::Bind(&SpeechRecognitionManagerImpl::DispatchEvent,
- weak_factory_.GetWeakPtr(), session_id, EVENT_STOP_CAPTURE));
+ weak_factory_.GetWeakPtr(),
+ session_id,
+ EVENT_STOP_CAPTURE));
}
// Here begins the SpeechRecognitionEventListener interface implementation,
@@ -331,9 +343,12 @@ void SpeechRecognitionManagerImpl::OnAudioEnd(int session_id) {
delegate_listener->OnAudioEnd(session_id);
if (SpeechRecognitionEventListener* listener = GetListener(session_id))
listener->OnAudioEnd(session_id);
- MessageLoop::current()->PostTask(FROM_HERE,
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
base::Bind(&SpeechRecognitionManagerImpl::DispatchEvent,
- weak_factory_.GetWeakPtr(), session_id, EVENT_AUDIO_ENDED));
+ weak_factory_.GetWeakPtr(),
+ session_id,
+ EVENT_AUDIO_ENDED));
}
void SpeechRecognitionManagerImpl::OnRecognitionResults(
@@ -390,7 +405,8 @@ void SpeechRecognitionManagerImpl::OnRecognitionEnd(int session_id) {
delegate_listener->OnRecognitionEnd(session_id);
if (SpeechRecognitionEventListener* listener = GetListener(session_id))
listener->OnRecognitionEnd(session_id);
- MessageLoop::current()->PostTask(FROM_HERE,
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
base::Bind(&SpeechRecognitionManagerImpl::DispatchEvent,
weak_factory_.GetWeakPtr(),
session_id,