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

Unified Diff: chrome/browser/ui/app_list/speech_recognizer.cc

Issue 636863003: Make SpeechRecognition per RenderFrame instead of per RenderView. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes threading issues Created 6 years, 1 month 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: chrome/browser/ui/app_list/speech_recognizer.cc
diff --git a/chrome/browser/ui/app_list/speech_recognizer.cc b/chrome/browser/ui/app_list/speech_recognizer.cc
index 4945b2ef2b2ebf7554186b00f7c3dff7ab8fcb0f..4f2788faa180af32402be03d11056120f2b137b6 100644
--- a/chrome/browser/ui/app_list/speech_recognizer.cc
+++ b/chrome/browser/ui/app_list/speech_recognizer.cc
@@ -11,6 +11,7 @@
#include "base/timer/timer.h"
#include "chrome/browser/ui/app_list/speech_recognizer_delegate.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/speech_recognition_event_listener.h"
#include "content/public/browser/speech_recognition_manager.h"
@@ -43,7 +44,7 @@ class SpeechRecognizer::EventListener
net::URLRequestContextGetter* url_request_context_getter,
const std::string& locale);
- void StartOnIOThread(int render_process_id);
+ void StartOnIOThread(int render_process_id, int render_frame_id);
void StopOnIOThread();
private:
@@ -104,7 +105,8 @@ SpeechRecognizer::EventListener::~EventListener() {
DCHECK(!speech_timeout_.IsRunning());
}
-void SpeechRecognizer::EventListener::StartOnIOThread(int render_process_id) {
+void SpeechRecognizer::EventListener::StartOnIOThread(int render_process_id,
+ int render_frame_id) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (session_ != kInvalidSessionId)
StopOnIOThread();
@@ -119,6 +121,7 @@ void SpeechRecognizer::EventListener::StartOnIOThread(int render_process_id) {
config.url_request_context_getter = url_request_context_getter_;
config.event_listener = weak_factory_.GetWeakPtr();
config.initial_context.render_process_id = render_process_id;
+ config.initial_context.render_frame_id = render_frame_id;
auto speech_instance = content::SpeechRecognitionManager::GetInstance();
session_ = speech_instance->CreateSession(config);
@@ -276,7 +279,8 @@ void SpeechRecognizer::Start() {
FROM_HERE,
base::Bind(&SpeechRecognizer::EventListener::StartOnIOThread,
speech_event_listener_,
- contents->GetRenderProcessHost()->GetID()));
+ contents->GetMainFrame()->GetProcess()->GetID(),
+ contents->GetMainFrame()->GetRoutingID()));
}
void SpeechRecognizer::Stop() {

Powered by Google App Engine
This is Rietveld 408576698