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

Side by Side Diff: Source/modules/speech/SpeechSynthesis.cpp

Issue 884973003: Extend PlatformSpeechSynthesizerMock with an utterance queue. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: minor test tidying Created 5 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 const HeapVector<Member<SpeechSynthesisVoice>>& SpeechSynthesis::getVoices() 66 const HeapVector<Member<SpeechSynthesisVoice>>& SpeechSynthesis::getVoices()
67 { 67 {
68 if (m_voiceList.size()) 68 if (m_voiceList.size())
69 return m_voiceList; 69 return m_voiceList;
70 70
71 // If the voiceList is empty, that's the cue to get the voices from the plat form again. 71 // If the voiceList is empty, that's the cue to get the voices from the plat form again.
72 const HeapVector<Member<PlatformSpeechSynthesisVoice>>& platformVoices = m_p latformSpeechSynthesizer->voiceList(); 72 const HeapVector<Member<PlatformSpeechSynthesisVoice>>& platformVoices = m_p latformSpeechSynthesizer->voiceList();
73 size_t voiceCount = platformVoices.size(); 73 size_t voiceCount = platformVoices.size();
74 for (size_t k = 0; k < voiceCount; k++) 74 for (size_t k = 0; k < voiceCount; k++)
75 m_voiceList.append(SpeechSynthesisVoice::create(platformVoices[k].get()) ); 75 m_voiceList.append(SpeechSynthesisVoice::create(platformVoices[k]));
76 76
77 return m_voiceList; 77 return m_voiceList;
78 } 78 }
79 79
80 bool SpeechSynthesis::speaking() const 80 bool SpeechSynthesis::speaking() const
81 { 81 {
82 // If we have a current speech utterance, then that means we're assumed to b e in a speaking state. 82 // If we have a current speech utterance, then that means we're assumed to b e in a speaking state.
83 // This state is independent of whether the utterance happens to be paused. 83 // This state is independent of whether the utterance happens to be paused.
84 return currentSpeechUtterance(); 84 return currentSpeechUtterance();
85 } 85 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 } 215 }
216 216
217 void SpeechSynthesis::speakingErrorOccurred(PlatformSpeechSynthesisUtterance* ut terance) 217 void SpeechSynthesis::speakingErrorOccurred(PlatformSpeechSynthesisUtterance* ut terance)
218 { 218 {
219 if (utterance->client()) 219 if (utterance->client())
220 handleSpeakingCompleted(static_cast<SpeechSynthesisUtterance*>(utterance ->client()), true); 220 handleSpeakingCompleted(static_cast<SpeechSynthesisUtterance*>(utterance ->client()), true);
221 } 221 }
222 222
223 SpeechSynthesisUtterance* SpeechSynthesis::currentSpeechUtterance() const 223 SpeechSynthesisUtterance* SpeechSynthesis::currentSpeechUtterance() const
224 { 224 {
225 if (!m_utteranceQueue.isEmpty()) 225 if (m_utteranceQueue.isEmpty())
226 return m_utteranceQueue.first().get(); 226 return nullptr;
227 return 0; 227
228 return m_utteranceQueue.first();
228 } 229 }
229 230
230 const AtomicString& SpeechSynthesis::interfaceName() const 231 const AtomicString& SpeechSynthesis::interfaceName() const
231 { 232 {
232 return EventTargetNames::SpeechSynthesis; 233 return EventTargetNames::SpeechSynthesis;
233 } 234 }
234 235
235 void SpeechSynthesis::trace(Visitor* visitor) 236 void SpeechSynthesis::trace(Visitor* visitor)
236 { 237 {
237 visitor->trace(m_platformSpeechSynthesizer); 238 visitor->trace(m_platformSpeechSynthesizer);
238 visitor->trace(m_voiceList); 239 visitor->trace(m_voiceList);
239 visitor->trace(m_utteranceQueue); 240 visitor->trace(m_utteranceQueue);
240 PlatformSpeechSynthesizerClient::trace(visitor); 241 PlatformSpeechSynthesizerClient::trace(visitor);
241 RefCountedGarbageCollectedEventTargetWithInlineData<SpeechSynthesis>::trace( visitor); 242 RefCountedGarbageCollectedEventTargetWithInlineData<SpeechSynthesis>::trace( visitor);
242 ContextLifecycleObserver::trace(visitor); 243 ContextLifecycleObserver::trace(visitor);
243 } 244 }
244 245
245 } // namespace blink 246 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/speech/SpeechRecognitionResultList.cpp ('k') | Source/modules/speech/SpeechSynthesisUtterance.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698