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

Side by Side Diff: chrome/browser/ui/app_list/speech_recognizer.cc

Issue 1413403004: Invalidate the weak factory in SpeechRecognizer::EventListener::StopOnIOThread(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/ui/app_list/speech_recognizer.h" 5 #include "chrome/browser/ui/app_list/speech_recognizer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 148 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
149 if (session_ == kInvalidSessionId) 149 if (session_ == kInvalidSessionId)
150 return; 150 return;
151 151
152 // Prevent recursion. 152 // Prevent recursion.
153 int session = session_; 153 int session = session_;
154 session_ = kInvalidSessionId; 154 session_ = kInvalidSessionId;
155 StopSpeechTimeout(); 155 StopSpeechTimeout();
156 content::SpeechRecognitionManager::GetInstance()->StopAudioCaptureForSession( 156 content::SpeechRecognitionManager::GetInstance()->StopAudioCaptureForSession(
157 session); 157 session);
158 weak_factory_.InvalidateWeakPtrs();
158 } 159 }
159 160
160 void SpeechRecognizer::EventListener::NotifyRecognitionStateChanged( 161 void SpeechRecognizer::EventListener::NotifyRecognitionStateChanged(
161 SpeechRecognitionState new_state) { 162 SpeechRecognitionState new_state) {
162 content::BrowserThread::PostTask( 163 content::BrowserThread::PostTask(
163 content::BrowserThread::UI, 164 content::BrowserThread::UI,
164 FROM_HERE, 165 FROM_HERE,
165 base::Bind(&SpeechRecognizerDelegate::OnSpeechRecognitionStateChanged, 166 base::Bind(&SpeechRecognizerDelegate::OnSpeechRecognitionStateChanged,
166 delegate_, 167 delegate_,
167 new_state)); 168 new_state));
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 void SpeechRecognizer::Stop() { 308 void SpeechRecognizer::Stop() {
308 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 309 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
309 content::BrowserThread::PostTask( 310 content::BrowserThread::PostTask(
310 content::BrowserThread::IO, 311 content::BrowserThread::IO,
311 FROM_HERE, 312 FROM_HERE,
312 base::Bind(&SpeechRecognizer::EventListener::StopOnIOThread, 313 base::Bind(&SpeechRecognizer::EventListener::StopOnIOThread,
313 speech_event_listener_)); 314 speech_event_listener_));
314 } 315 }
315 316
316 } // namespace app_list 317 } // namespace app_list
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698