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 11 matching lines...) Expand all Loading... | |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef SpeechSynthesis_h | 26 #ifndef SpeechSynthesis_h |
27 #define SpeechSynthesis_h | 27 #define SpeechSynthesis_h |
28 | 28 |
29 #include "bindings/v8/ScriptWrappable.h" | 29 #include "bindings/v8/ScriptWrappable.h" |
30 #include "core/dom/ContextLifecycleObserver.h" | 30 #include "core/dom/ContextLifecycleObserver.h" |
31 #include "core/events/EventTarget.h" | 31 #include "core/events/EventTarget.h" |
32 #include "heap/Handle.h" | |
32 #include "modules/speech/SpeechSynthesisUtterance.h" | 33 #include "modules/speech/SpeechSynthesisUtterance.h" |
33 #include "modules/speech/SpeechSynthesisVoice.h" | 34 #include "modules/speech/SpeechSynthesisVoice.h" |
34 #include "platform/speech/PlatformSpeechSynthesisUtterance.h" | 35 #include "platform/speech/PlatformSpeechSynthesisUtterance.h" |
35 #include "platform/speech/PlatformSpeechSynthesizer.h" | 36 #include "platform/speech/PlatformSpeechSynthesizer.h" |
36 #include "wtf/Deque.h" | 37 #include "wtf/Deque.h" |
37 #include "wtf/PassRefPtr.h" | 38 #include "wtf/PassRefPtr.h" |
38 #include "wtf/RefCounted.h" | 39 #include "wtf/RefCounted.h" |
39 #include "wtf/RefPtr.h" | 40 #include "wtf/RefPtr.h" |
40 | 41 |
41 namespace WebCore { | 42 namespace WebCore { |
42 | 43 |
43 class ExceptionState; | 44 class ExceptionState; |
44 class PlatformSpeechSynthesizerClient; | 45 class PlatformSpeechSynthesizerClient; |
45 class SpeechSynthesisVoice; | |
46 | 46 |
47 class SpeechSynthesis FINAL : public PlatformSpeechSynthesizerClient, public Scr iptWrappable, public RefCounted<SpeechSynthesis>, public ContextLifecycleObserve r, public EventTargetWithInlineData { | 47 class SpeechSynthesis FINAL : public RefCountedWillBeRefCountedGarbageCollected< SpeechSynthesis>, public PlatformSpeechSynthesizerClient, public ScriptWrappable , public ContextLifecycleObserver, public EventTargetWithInlineData { |
48 REFCOUNTED_EVENT_TARGET(SpeechSynthesis); | 48 DECLARE_GC_INFO; |
49 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollected<S peechSynthesis>); | |
49 public: | 50 public: |
50 static PassRefPtr<SpeechSynthesis> create(ExecutionContext*); | 51 static PassRefPtrWillBeRawPtr<SpeechSynthesis> create(ExecutionContext*); |
51 | 52 |
52 bool pending() const; | 53 bool pending() const; |
53 bool speaking() const; | 54 bool speaking() const; |
54 bool paused() const; | 55 bool paused() const; |
55 | 56 |
56 void speak(SpeechSynthesisUtterance*, ExceptionState&); | 57 void speak(SpeechSynthesisUtterance*, ExceptionState&); |
57 void cancel(); | 58 void cancel(); |
58 void pause(); | 59 void pause(); |
59 void resume(); | 60 void resume(); |
60 | 61 |
61 const Vector<RefPtr<SpeechSynthesisVoice> >& getVoices(); | 62 const Vector<RefPtrWillBeMember<SpeechSynthesisVoice> >& getVoices(); |
62 | 63 |
63 // Used in testing to use a mock platform synthesizer | 64 // Used in testing to use a mock platform synthesizer |
64 void setPlatformSynthesizer(PassOwnPtr<PlatformSpeechSynthesizer>); | 65 void setPlatformSynthesizer(PassOwnPtr<PlatformSpeechSynthesizer>); |
65 | 66 |
66 DEFINE_ATTRIBUTE_EVENT_LISTENER(voiceschanged); | 67 DEFINE_ATTRIBUTE_EVENT_LISTENER(voiceschanged); |
67 | 68 |
68 virtual ExecutionContext* executionContext() const OVERRIDE; | 69 virtual ExecutionContext* executionContext() const OVERRIDE; |
69 | 70 |
71 void trace(Visitor*); | |
72 | |
70 private: | 73 private: |
71 explicit SpeechSynthesis(ExecutionContext*); | 74 explicit SpeechSynthesis(ExecutionContext*); |
72 | 75 |
73 // PlatformSpeechSynthesizerClient override methods. | 76 // PlatformSpeechSynthesizerClient override methods. |
74 virtual void voicesDidChange() OVERRIDE; | 77 virtual void voicesDidChange() OVERRIDE; |
75 virtual void didStartSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>) OVERRIDE; | 78 virtual void didStartSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>) OVERRIDE; |
76 virtual void didPauseSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>) OVERRIDE; | 79 virtual void didPauseSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>) OVERRIDE; |
77 virtual void didResumeSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>) OVERRIDE; | 80 virtual void didResumeSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>) OVERRIDE; |
78 virtual void didFinishSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>) OVERRIDE; | 81 virtual void didFinishSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>) OVERRIDE; |
79 virtual void speakingErrorOccurred(PassRefPtr<PlatformSpeechSynthesisUtteran ce>) OVERRIDE; | 82 virtual void speakingErrorOccurred(PassRefPtr<PlatformSpeechSynthesisUtteran ce>) OVERRIDE; |
80 virtual void boundaryEventOccurred(PassRefPtr<PlatformSpeechSynthesisUtteran ce>, SpeechBoundary, unsigned charIndex) OVERRIDE; | 83 virtual void boundaryEventOccurred(PassRefPtr<PlatformSpeechSynthesisUtteran ce>, SpeechBoundary, unsigned charIndex) OVERRIDE; |
81 | 84 |
82 void startSpeakingImmediately(SpeechSynthesisUtterance*); | 85 void startSpeakingImmediately(SpeechSynthesisUtterance*); |
83 void handleSpeakingCompleted(SpeechSynthesisUtterance*, bool errorOccurred); | 86 void handleSpeakingCompleted(SpeechSynthesisUtterance*, bool errorOccurred); |
84 void fireEvent(const AtomicString& type, SpeechSynthesisUtterance*, unsigned long charIndex, const String& name); | 87 void fireEvent(const AtomicString& type, SpeechSynthesisUtterance*, unsigned long charIndex, const String& name); |
85 | 88 |
86 OwnPtr<PlatformSpeechSynthesizer> m_platformSpeechSynthesizer; | 89 OwnPtr<PlatformSpeechSynthesizer> m_platformSpeechSynthesizer; |
87 Vector<RefPtr<SpeechSynthesisVoice> > m_voiceList; | 90 Vector<RefPtrWillBeMember<SpeechSynthesisVoice> > m_voiceList; |
haraken
2014/02/12 05:18:45
WillBeHeapVector<RefPtrWillBeMember<>>.
sof
2014/02/12 10:17:09
Done.
| |
88 SpeechSynthesisUtterance* m_currentSpeechUtterance; | 91 RawPtrWillBeMember<SpeechSynthesisUtterance> m_currentSpeechUtterance; |
89 Deque<RefPtr<SpeechSynthesisUtterance> > m_utteranceQueue; | 92 Deque<RefPtrWillBeMember<SpeechSynthesisUtterance> > m_utteranceQueue; |
haraken
2014/02/12 05:18:45
We haven't yet supported HeapDeque, so it's OK to
sof
2014/02/12 10:17:09
Done.
| |
90 bool m_isPaused; | 93 bool m_isPaused; |
91 | 94 |
92 // EventTarget | 95 // EventTarget |
93 virtual const AtomicString& interfaceName() const OVERRIDE; | 96 virtual const AtomicString& interfaceName() const OVERRIDE; |
94 }; | 97 }; |
95 | 98 |
96 } // namespace WebCore | 99 } // namespace WebCore |
97 | 100 |
98 #endif // SpeechSynthesisEvent_h | 101 #endif // SpeechSynthesisEvent_h |
OLD | NEW |