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

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

Issue 2552993002: Rename activeDOMObjectsAreStopped to isContextDestroyed (Closed)
Patch Set: Created 4 years 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 PlatformSpeechSynthesizer* synthesizer) { 45 PlatformSpeechSynthesizer* synthesizer) {
46 m_platformSpeechSynthesizer = synthesizer; 46 m_platformSpeechSynthesizer = synthesizer;
47 } 47 }
48 48
49 ExecutionContext* SpeechSynthesis::getExecutionContext() const { 49 ExecutionContext* SpeechSynthesis::getExecutionContext() const {
50 return ContextLifecycleObserver::getExecutionContext(); 50 return ContextLifecycleObserver::getExecutionContext();
51 } 51 }
52 52
53 void SpeechSynthesis::voicesDidChange() { 53 void SpeechSynthesis::voicesDidChange() {
54 m_voiceList.clear(); 54 m_voiceList.clear();
55 if (getExecutionContext() && 55 if (getExecutionContext() && !getExecutionContext()->isContextDestroyed())
56 !getExecutionContext()->activeDOMObjectsAreStopped())
57 dispatchEvent(Event::create(EventTypeNames::voiceschanged)); 56 dispatchEvent(Event::create(EventTypeNames::voiceschanged));
58 } 57 }
59 58
60 const HeapVector<Member<SpeechSynthesisVoice>>& SpeechSynthesis::getVoices() { 59 const HeapVector<Member<SpeechSynthesisVoice>>& SpeechSynthesis::getVoices() {
61 if (m_voiceList.size()) 60 if (m_voiceList.size())
62 return m_voiceList; 61 return m_voiceList;
63 62
64 // If the voiceList is empty, that's the cue to get the voices from the 63 // If the voiceList is empty, that's the cue to get the voices from the
65 // platform again. 64 // platform again.
66 const Vector<RefPtr<PlatformSpeechSynthesisVoice>>& platformVoices = 65 const Vector<RefPtr<PlatformSpeechSynthesisVoice>>& platformVoices =
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 void SpeechSynthesis::resume() { 123 void SpeechSynthesis::resume() {
125 if (!currentSpeechUtterance()) 124 if (!currentSpeechUtterance())
126 return; 125 return;
127 m_platformSpeechSynthesizer->resume(); 126 m_platformSpeechSynthesizer->resume();
128 } 127 }
129 128
130 void SpeechSynthesis::fireEvent(const AtomicString& type, 129 void SpeechSynthesis::fireEvent(const AtomicString& type,
131 SpeechSynthesisUtterance* utterance, 130 SpeechSynthesisUtterance* utterance,
132 unsigned long charIndex, 131 unsigned long charIndex,
133 const String& name) { 132 const String& name) {
134 if (getExecutionContext() && 133 if (getExecutionContext() && !getExecutionContext()->isContextDestroyed()) {
135 !getExecutionContext()->activeDOMObjectsAreStopped()) {
136 double elapsedTimeMillis = 134 double elapsedTimeMillis =
137 (monotonicallyIncreasingTime() - utterance->startTime()) * 1000.0; 135 (monotonicallyIncreasingTime() - utterance->startTime()) * 1000.0;
138 utterance->dispatchEvent(SpeechSynthesisEvent::create( 136 utterance->dispatchEvent(SpeechSynthesisEvent::create(
139 type, utterance, charIndex, elapsedTimeMillis, name)); 137 type, utterance, charIndex, elapsedTimeMillis, name));
140 } 138 }
141 } 139 }
142 140
143 void SpeechSynthesis::handleSpeakingCompleted( 141 void SpeechSynthesis::handleSpeakingCompleted(
144 SpeechSynthesisUtterance* utterance, 142 SpeechSynthesisUtterance* utterance,
145 bool errorOccurred) { 143 bool errorOccurred) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 DEFINE_TRACE(SpeechSynthesis) { 240 DEFINE_TRACE(SpeechSynthesis) {
243 visitor->trace(m_platformSpeechSynthesizer); 241 visitor->trace(m_platformSpeechSynthesizer);
244 visitor->trace(m_voiceList); 242 visitor->trace(m_voiceList);
245 visitor->trace(m_utteranceQueue); 243 visitor->trace(m_utteranceQueue);
246 PlatformSpeechSynthesizerClient::trace(visitor); 244 PlatformSpeechSynthesizerClient::trace(visitor);
247 EventTargetWithInlineData::trace(visitor); 245 EventTargetWithInlineData::trace(visitor);
248 ContextLifecycleObserver::trace(visitor); 246 ContextLifecycleObserver::trace(visitor);
249 } 247 }
250 248
251 } // namespace blink 249 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698