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

Unified Diff: content/browser/speech/speech_recognition_manager_impl.cc

Issue 10273006: Introduced SpeechRecognitionDispatcher(Host) classes, handling dispatch of IPC messages for continu… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test fixed + Satish nits. Created 8 years, 7 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
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 7a0d5c814104717152dd983d5494f704fc31f756..832ed2b3a13d8a39543eca3b23bd262c7edccd1e 100644
--- a/content/browser/speech/speech_recognition_manager_impl.cc
+++ b/content/browser/speech/speech_recognition_manager_impl.cc
@@ -284,20 +284,18 @@ void SpeechRecognitionManagerImpl::OnRecognitionEnd(int session_id) {
session_id, EVENT_RECOGNITION_ENDED));
}
-// TODO(primiano) After CL2: if we see that both InputTagDispatcherHost and
-// SpeechRecognitionDispatcherHost do the same lookup operations, implement the
-// lookup method directly here.
-int SpeechRecognitionManagerImpl::LookupSessionByContext(
- Callback<bool(const SpeechRecognitionSessionContext&)> matcher) const {
+int SpeechRecognitionManagerImpl::GetSession(
+ int render_process_id, int render_view_id, int request_id) const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
SessionsTable::const_iterator iter;
- // Note: the callback (matcher) must NEVER perform non-const calls on us.
for(iter = sessions_.begin(); iter != sessions_.end(); ++iter) {
const int session_id = iter->first;
- const Session& session = iter->second;
- bool matches = matcher.Run(session.context);
- if (matches)
+ 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;
+ }
}
return kSessionIDInvalid;
}

Powered by Google App Engine
This is Rietveld 408576698