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 3fde571de2d214e8832e86dbc198280777da587e..6b86f4bfbb51fee165a9bd79596e40c5161bcb2d 100644 |
--- a/content/browser/speech/speech_recognition_manager_impl.cc |
+++ b/content/browser/speech/speech_recognition_manager_impl.cc |
@@ -431,18 +431,17 @@ 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) { |
+ return session->id; |
} |
} |
+ |
return kSessionIDInvalid; |
} |
@@ -451,31 +450,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); |
} |
} |