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

Unified Diff: chrome/browser/speech/speech_input_dispatcher_host.cc

Issue 6358007: Cancel any pending speech recognitions when the dispatcher host terminates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 11 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 | « chrome/browser/speech/speech_input_dispatcher_host.h ('k') | chrome/browser/speech/speech_input_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/speech/speech_input_dispatcher_host.cc
diff --git a/chrome/browser/speech/speech_input_dispatcher_host.cc b/chrome/browser/speech/speech_input_dispatcher_host.cc
index 50b9aec9d86e54f6e95a6a25b8a510139615aabd..2c9d3f3751e0902131c530d372d7ac376bed2b10 100644
--- a/chrome/browser/speech/speech_input_dispatcher_host.cc
+++ b/chrome/browser/speech/speech_input_dispatcher_host.cc
@@ -105,13 +105,21 @@ SpeechInputManager::AccessorMethod*
SpeechInputDispatcherHost::manager_accessor_ = &SpeechInputManager::Get;
SpeechInputDispatcherHost::SpeechInputDispatcherHost(int render_process_id)
- : render_process_id_(render_process_id) {
+ : render_process_id_(render_process_id),
+ received_speech_request_(false) {
// This is initialized by Browser. Do not add any non-trivial
// initialization here, instead do it lazily when required (e.g. see the
// method |manager()|) or add an Init() method.
}
SpeechInputDispatcherHost::~SpeechInputDispatcherHost() {
+ // If the renderer crashed for some reason or if we didn't receive a proper
+ // Cancel/Stop call for an existing session, cancel such active sessions now.
+ // We first check if this dispatcher received any speech IPC requst so that
+ // we don't end up creating the speech input manager for web pages which don't
+ // use speech input.
+ if (received_speech_request_)
bulach 2011/01/20 14:47:20 suggest: may_have_pending_requests_ ? it seems sli
Satish 2011/01/20 15:09:03 Done.
+ manager()->CancelAllRequestsWithDelegate(this);
}
SpeechInputManager* SpeechInputDispatcherHost::manager() {
@@ -131,6 +139,7 @@ bool SpeechInputDispatcherHost::OnMessageReceived(
return true;
}
+ received_speech_request_ = true;
IPC_BEGIN_MESSAGE_MAP_EX(SpeechInputDispatcherHost, message,
*message_was_ok)
IPC_MESSAGE_HANDLER(ViewHostMsg_SpeechInput_StartRecognition,
« no previous file with comments | « chrome/browser/speech/speech_input_dispatcher_host.h ('k') | chrome/browser/speech/speech_input_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698