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

Side by Side Diff: chrome/browser/extensions/extension_tts_api_controller.h

Issue 8437080: Fix crash when TTS utterances are queued on shutdown. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_tts_api_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TTS_API_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TTS_API_CONTROLLER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TTS_API_CONTROLLER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TTS_API_CONTROLLER_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 const std::string& error_message); 212 const std::string& error_message);
213 213
214 // Return a list of all available voices, including the native voice, 214 // Return a list of all available voices, including the native voice,
215 // if supported, and all voices registered by extensions. 215 // if supported, and all voices registered by extensions.
216 base::ListValue* GetVoices(Profile* profile); 216 base::ListValue* GetVoices(Profile* profile);
217 217
218 // For unit testing. 218 // For unit testing.
219 void SetPlatformImpl(ExtensionTtsPlatformImpl* platform_impl); 219 void SetPlatformImpl(ExtensionTtsPlatformImpl* platform_impl);
220 int QueueSize(); 220 int QueueSize();
221 221
222 private: 222 protected:
223 ExtensionTtsController(); 223 ExtensionTtsController();
224 virtual ~ExtensionTtsController(); 224 virtual ~ExtensionTtsController();
225 225
226 private:
226 // Get the platform TTS implementation (or injected mock). 227 // Get the platform TTS implementation (or injected mock).
227 ExtensionTtsPlatformImpl* GetPlatformImpl(); 228 ExtensionTtsPlatformImpl* GetPlatformImpl();
228 229
229 // Start speaking the given utterance. Will either take ownership of 230 // Start speaking the given utterance. Will either take ownership of
230 // |utterance| or delete it if there's an error. Returns true on success. 231 // |utterance| or delete it if there's an error. Returns true on success.
231 void SpeakNow(Utterance* utterance); 232 void SpeakNow(Utterance* utterance);
232 233
233 // Clear the utterance queue. 234 // Clear the utterance queue. If send_events is true, will send
234 void ClearUtteranceQueue(); 235 // TTS_EVENT_CANCELLED events on each one.
236 void ClearUtteranceQueue(bool send_events);
235 237
236 // Finalize and delete the current utterance. 238 // Finalize and delete the current utterance.
237 void FinishCurrentUtterance(); 239 void FinishCurrentUtterance();
238 240
239 // Start speaking the next utterance in the queue. 241 // Start speaking the next utterance in the queue.
240 void SpeakNextUtterance(); 242 void SpeakNextUtterance();
241 243
242 friend struct DefaultSingletonTraits<ExtensionTtsController>; 244 friend struct DefaultSingletonTraits<ExtensionTtsController>;
243 245
244 // The current utterance being spoken. 246 // The current utterance being spoken.
245 Utterance* current_utterance_; 247 Utterance* current_utterance_;
246 248
247 // A queue of utterances to speak after the current one finishes. 249 // A queue of utterances to speak after the current one finishes.
248 std::queue<Utterance*> utterance_queue_; 250 std::queue<Utterance*> utterance_queue_;
249 251
250 // A pointer to the platform implementation of text-to-speech, for 252 // A pointer to the platform implementation of text-to-speech, for
251 // dependency injection. 253 // dependency injection.
252 ExtensionTtsPlatformImpl* platform_impl_; 254 ExtensionTtsPlatformImpl* platform_impl_;
253 255
254 DISALLOW_COPY_AND_ASSIGN(ExtensionTtsController); 256 DISALLOW_COPY_AND_ASSIGN(ExtensionTtsController);
255 }; 257 };
256 258
257 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TTS_API_CONTROLLER_H_ 259 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TTS_API_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_tts_api_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698