Chromium Code Reviews| 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, |