Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 m_voiceList.clear(); | 54 m_voiceList.clear(); |
| 55 if (getExecutionContext() && | 55 if (getExecutionContext() && |
| 56 !getExecutionContext()->activeDOMObjectsAreStopped()) | 56 !getExecutionContext()->activeDOMObjectsAreStopped()) |
| 57 dispatchEvent(Event::create(EventTypeNames::voiceschanged)); | 57 dispatchEvent(Event::create(EventTypeNames::voiceschanged)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 const HeapVector<Member<SpeechSynthesisVoice>>& SpeechSynthesis::getVoices() { | 60 const HeapVector<Member<SpeechSynthesisVoice>>& SpeechSynthesis::getVoices() { |
| 61 if (m_voiceList.size()) | 61 if (m_voiceList.size()) |
| 62 return m_voiceList; | 62 return m_voiceList; |
| 63 | 63 |
| 64 // If the voiceList is empty, that's the cue to get the voices from the platfo rm again. | 64 // If the voiceList is empty, that's the cue to get the voices from the |
| 65 // platform again. | |
| 65 const Vector<RefPtr<PlatformSpeechSynthesisVoice>>& platformVoices = | 66 const Vector<RefPtr<PlatformSpeechSynthesisVoice>>& platformVoices = |
| 66 m_platformSpeechSynthesizer->voiceList(); | 67 m_platformSpeechSynthesizer->voiceList(); |
| 67 size_t voiceCount = platformVoices.size(); | 68 size_t voiceCount = platformVoices.size(); |
| 68 for (size_t k = 0; k < voiceCount; k++) | 69 for (size_t k = 0; k < voiceCount; k++) |
| 69 m_voiceList.append(SpeechSynthesisVoice::create(platformVoices[k])); | 70 m_voiceList.append(SpeechSynthesisVoice::create(platformVoices[k])); |
| 70 | 71 |
| 71 return m_voiceList; | 72 return m_voiceList; |
| 72 } | 73 } |
| 73 | 74 |
| 74 bool SpeechSynthesis::speaking() const { | 75 bool SpeechSynthesis::speaking() const { |
| 75 // If we have a current speech utterance, then that means we're assumed to be in a speaking state. | 76 // If we have a current speech utterance, then that means we're assumed to be |
| 77 // in a speaking state. | |
| 76 // This state is independent of whether the utterance happens to be paused. | 78 // This state is independent of whether the utterance happens to be paused. |
|
Nico
2016/10/03 17:03:02
nit: put on previous line?
hans
2016/10/03 17:33:54
Done.
| |
| 77 return currentSpeechUtterance(); | 79 return currentSpeechUtterance(); |
| 78 } | 80 } |
| 79 | 81 |
| 80 bool SpeechSynthesis::pending() const { | 82 bool SpeechSynthesis::pending() const { |
| 81 // This is true if there are any utterances that have not started. | 83 // This is true if there are any utterances that have not started. |
| 82 // That means there will be more than one in the queue. | 84 // That means there will be more than one in the queue. |
| 83 return m_utteranceQueue.size() > 1; | 85 return m_utteranceQueue.size() > 1; |
| 84 } | 86 } |
| 85 | 87 |
| 86 bool SpeechSynthesis::paused() const { | 88 bool SpeechSynthesis::paused() const { |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 240 DEFINE_TRACE(SpeechSynthesis) { | 242 DEFINE_TRACE(SpeechSynthesis) { |
| 241 visitor->trace(m_platformSpeechSynthesizer); | 243 visitor->trace(m_platformSpeechSynthesizer); |
| 242 visitor->trace(m_voiceList); | 244 visitor->trace(m_voiceList); |
| 243 visitor->trace(m_utteranceQueue); | 245 visitor->trace(m_utteranceQueue); |
| 244 PlatformSpeechSynthesizerClient::trace(visitor); | 246 PlatformSpeechSynthesizerClient::trace(visitor); |
| 245 EventTargetWithInlineData::trace(visitor); | 247 EventTargetWithInlineData::trace(visitor); |
| 246 ContextLifecycleObserver::trace(visitor); | 248 ContextLifecycleObserver::trace(visitor); |
| 247 } | 249 } |
| 248 | 250 |
| 249 } // namespace blink | 251 } // namespace blink |
| OLD | NEW |