| 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 8a4d1b465353949a8f82fb67a81579ff2a6fc253..f1c7569c1efc1f8299a715bb3f50500c8bc4a8ae 100644
|
| --- a/content/browser/speech/speech_recognition_manager_impl.cc
|
| +++ b/content/browser/speech/speech_recognition_manager_impl.cc
|
| @@ -434,18 +434,18 @@ void SpeechRecognitionManagerImpl::OnRecognitionEnd(int session_id) {
|
| }
|
|
|
| int SpeechRecognitionManagerImpl::GetSession(
|
| - int render_process_id, int render_view_id, int request_id) const {
|
| + int render_process_id, int render_frame_id, int request_id) const {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| - SessionsTable::const_iterator iter;
|
| - for (iter = sessions_.begin(); iter != sessions_.end(); ++iter) {
|
| - const int session_id = iter->first;
|
| - const SpeechRecognitionSessionContext& context = iter->second->context;
|
| - if (context.render_process_id == render_process_id &&
|
| - context.render_view_id == render_view_id &&
|
| - context.request_id == request_id) {
|
| - return session_id;
|
| +
|
| + for (const auto& it : sessions_) {
|
| + Session* session = it.second;
|
| + if (session->context.render_process_id == render_process_id &&
|
| + session->context.render_frame_id == render_frame_id &&
|
| + session->context.request_id == request_id) {
|
| + return session->id;
|
| }
|
| }
|
| +
|
| return kSessionIDInvalid;
|
| }
|
|
|
| @@ -454,31 +454,14 @@ SpeechRecognitionManagerImpl::GetSessionContext(int session_id) const {
|
| return GetSession(session_id)->context;
|
| }
|
|
|
| -void SpeechRecognitionManagerImpl::AbortAllSessionsForRenderProcess(
|
| - int render_process_id) {
|
| - // This method gracefully destroys sessions for the listener. However, since
|
| - // the listener itself is likely to be destroyed after this call, we avoid
|
| - // dispatching further events to it, marking the |listener_is_active| flag.
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| - for (SessionsTable::iterator it = sessions_.begin(); it != sessions_.end();
|
| - ++it) {
|
| - Session* session = it->second;
|
| - if (session->context.render_process_id == render_process_id) {
|
| - AbortSession(session->id);
|
| - session->listener_is_active = false;
|
| - }
|
| - }
|
| -}
|
| +void SpeechRecognitionManagerImpl::AbortAllSessionsForRenderFrame(
|
| + int render_process_id, int render_frame_id) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
|
|
| -void SpeechRecognitionManagerImpl::AbortAllSessionsForRenderView(
|
| - int render_process_id,
|
| - int render_view_id) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| - for (SessionsTable::iterator it = sessions_.begin(); it != sessions_.end();
|
| - ++it) {
|
| - Session* session = it->second;
|
| + for (const auto& it : sessions_) {
|
| + Session* session = it.second;
|
| if (session->context.render_process_id == render_process_id &&
|
| - session->context.render_view_id == render_view_id) {
|
| + session->context.render_frame_id == render_frame_id) {
|
| AbortSession(session->id);
|
| }
|
| }
|
|
|