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

Side by Side Diff: chrome/browser/extensions/extension_tts_engine_api.cc

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
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 #include "chrome/browser/extensions/extension_tts_engine_api.h" 5 #include "chrome/browser/extensions/extension_tts_engine_api.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 result_voice->Set(constants::kEventTypesKey, event_types); 73 result_voice->Set(constants::kEventTypesKey, event_types);
74 result_voices->Append(result_voice); 74 result_voices->Append(result_voice);
75 } 75 }
76 } 76 }
77 } 77 }
78 78
79 bool GetMatchingExtensionVoice( 79 bool GetMatchingExtensionVoice(
80 Utterance* utterance, 80 Utterance* utterance,
81 const Extension** matching_extension, 81 const Extension** matching_extension,
82 size_t* voice_index) { 82 size_t* voice_index) {
83 // This will only happen during unit testing. Otherwise, an utterance
84 // will always have an associated profile.
85 if (!utterance->profile())
86 return false;
87
83 ExtensionService* service = utterance->profile()->GetExtensionService(); 88 ExtensionService* service = utterance->profile()->GetExtensionService();
84 DCHECK(service); 89 DCHECK(service);
85 ExtensionEventRouter* event_router = 90 ExtensionEventRouter* event_router =
86 utterance->profile()->GetExtensionEventRouter(); 91 utterance->profile()->GetExtensionEventRouter();
87 DCHECK(event_router); 92 DCHECK(event_router);
88 93
89 *matching_extension = NULL; 94 *matching_extension = NULL;
90 *voice_index = -1; 95 *voice_index = -1;
91 const ExtensionList* extensions = service->extensions(); 96 const ExtensionList* extensions = service->extensions();
92 ExtensionList::const_iterator iter; 97 ExtensionList::const_iterator iter;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 std::string error_message; 257 std::string error_message;
253 event->GetString(constants::kErrorMessageKey, &error_message); 258 event->GetString(constants::kErrorMessageKey, &error_message);
254 controller->OnTtsEvent( 259 controller->OnTtsEvent(
255 utterance_id, TTS_EVENT_ERROR, char_index, error_message); 260 utterance_id, TTS_EVENT_ERROR, char_index, error_message);
256 } else { 261 } else {
257 EXTENSION_FUNCTION_VALIDATE(false); 262 EXTENSION_FUNCTION_VALIDATE(false);
258 } 263 }
259 264
260 return true; 265 return true;
261 } 266 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_tts_api_controller_unittest.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698