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

Unified Diff: content/browser/speech/speech_recognition_manager_impl.cc

Issue 1159623009: content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test build fix. Created 5 years, 6 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
Index: content/browser/speech/speech_recognition_manager_impl.cc
diff --git a/content/browser/speech/speech_recognition_manager_impl.cc b/content/browser/speech/speech_recognition_manager_impl.cc
index f02c29f1dd41ee642cbffd91f1206b4443ea708c..019abe1a8d33d370d9cf2e132a88f1b6c76d5ed4 100644
--- a/content/browser/speech/speech_recognition_manager_impl.cc
+++ b/content/browser/speech/speech_recognition_manager_impl.cc
@@ -5,6 +5,9 @@
#include "content/browser/speech/speech_recognition_manager_impl.h"
#include "base/bind.h"
+#include "base/location.h"
+#include "base/single_thread_task_runner.h"
+#include "base/thread_task_runner_handle.h"
#include "content/browser/browser_main_loop.h"
#include "content/browser/renderer_host/media/media_stream_manager.h"
#include "content/browser/renderer_host/media/media_stream_ui_proxy.h"
@@ -210,21 +213,17 @@ void SpeechRecognitionManagerImpl::RecognitionAllowedCallback(int session_id,
}
if (is_allowed) {
- base::MessageLoop::current()->PostTask(
+ base::ThreadTaskRunnerHandle::Get()->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));
- base::MessageLoop::current()->PostTask(
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::Bind(&SpeechRecognitionManagerImpl::DispatchEvent,
- weak_factory_.GetWeakPtr(),
- session_id,
- EVENT_ABORT));
+ weak_factory_.GetWeakPtr(), session_id, EVENT_ABORT));
}
}
@@ -267,12 +266,10 @@ void SpeechRecognitionManagerImpl::AbortSession(int session_id) {
iter->second->abort_requested = true;
- base::MessageLoop::current()->PostTask(
+ base::ThreadTaskRunnerHandle::Get()->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) {
@@ -283,12 +280,10 @@ void SpeechRecognitionManagerImpl::StopAudioCaptureForSession(int session_id) {
SessionsTable::iterator iter = sessions_.find(session_id);
iter->second->ui.reset();
- base::MessageLoop::current()->PostTask(
+ base::ThreadTaskRunnerHandle::Get()->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,
@@ -372,12 +367,10 @@ void SpeechRecognitionManagerImpl::OnAudioEnd(int session_id) {
delegate_listener->OnAudioEnd(session_id);
if (SpeechRecognitionEventListener* listener = GetListener(session_id))
listener->OnAudioEnd(session_id);
- base::MessageLoop::current()->PostTask(
+ base::ThreadTaskRunnerHandle::Get()->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(
@@ -425,12 +418,10 @@ void SpeechRecognitionManagerImpl::OnRecognitionEnd(int session_id) {
delegate_listener->OnRecognitionEnd(session_id);
if (SpeechRecognitionEventListener* listener = GetListener(session_id))
listener->OnRecognitionEnd(session_id);
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&SpeechRecognitionManagerImpl::DispatchEvent,
- weak_factory_.GetWeakPtr(),
- session_id,
- EVENT_RECOGNITION_ENDED));
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&SpeechRecognitionManagerImpl::DispatchEvent,
+ weak_factory_.GetWeakPtr(), session_id,
+ EVENT_RECOGNITION_ENDED));
}
int SpeechRecognitionManagerImpl::GetSession(
« no previous file with comments | « content/browser/speech/speech_recognition_browsertest.cc ('k') | content/browser/speech/speech_recognizer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698