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

Side by Side Diff: content/browser/speech/speech_recognition_manager_impl.cc

Issue 12982009: Fixed the speech crash when the render view has gone away then users click "try again" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/speech/speech_recognition_manager_impl.h" 5 #include "content/browser/speech/speech_recognition_manager_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "content/browser/browser_main_loop.h" 8 #include "content/browser/browser_main_loop.h"
9 #include "content/browser/renderer_host/media/media_stream_manager.h" 9 #include "content/browser/renderer_host/media/media_stream_manager.h"
10 #include "content/browser/speech/google_one_shot_remote_engine.h" 10 #include "content/browser/speech/google_one_shot_remote_engine.h"
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 // This method gracefully destroys sessions for the listener. However, since 423 // This method gracefully destroys sessions for the listener. However, since
424 // the listener itself is likely to be destroyed after this call, we avoid 424 // the listener itself is likely to be destroyed after this call, we avoid
425 // dispatching further events to it, marking the |listener_is_active| flag. 425 // dispatching further events to it, marking the |listener_is_active| flag.
426 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 426 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
427 for (SessionsTable::iterator it = sessions_.begin(); it != sessions_.end(); 427 for (SessionsTable::iterator it = sessions_.begin(); it != sessions_.end();
428 ++it) { 428 ++it) {
429 Session& session = it->second; 429 Session& session = it->second;
430 if (session.config.event_listener == listener) { 430 if (session.config.event_listener == listener) {
431 AbortSession(session.id); 431 AbortSession(session.id);
432 session.listener_is_active = false; 432 session.listener_is_active = false;
433 if (delegate_)
434 delegate_->OnAbortSessionsForListener(listener);
tommi (sloooow) - chröme 2013/03/28 10:38:46 I think we can improve upon the name of the method
433 } 435 }
434 } 436 }
435 } 437 }
436 438
437 void SpeechRecognitionManagerImpl::AbortAllSessionsForRenderView( 439 void SpeechRecognitionManagerImpl::AbortAllSessionsForRenderView(
438 int render_process_id, 440 int render_process_id,
439 int render_view_id) { 441 int render_view_id) {
440 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 442 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
441 for (SessionsTable::iterator it = sessions_.begin(); it != sessions_.end(); 443 for (SessionsTable::iterator it = sessions_.begin(); it != sessions_.end();
442 ++it) { 444 ++it) {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 643
642 SpeechRecognitionManagerImpl::Session::Session() 644 SpeechRecognitionManagerImpl::Session::Session()
643 : id(kSessionIDInvalid), 645 : id(kSessionIDInvalid),
644 listener_is_active(true) { 646 listener_is_active(true) {
645 } 647 }
646 648
647 SpeechRecognitionManagerImpl::Session::~Session() { 649 SpeechRecognitionManagerImpl::Session::~Session() {
648 } 650 }
649 651
650 } // namespace content 652 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698