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 16 matching lines...) Expand all Loading... |
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 "modules/EventTargetModules.h" | 31 #include "modules/EventTargetModules.h" |
32 #include "modules/speech/SpeechSynthesisUtterance.h" | 32 #include "modules/speech/SpeechSynthesisUtterance.h" |
33 #include "modules/speech/SpeechSynthesisVoice.h" | 33 #include "modules/speech/SpeechSynthesisVoice.h" |
34 #include "platform/heap/Handle.h" | 34 #include "platform/heap/Handle.h" |
35 #include "platform/speech/PlatformSpeechSynthesisUtterance.h" | 35 #include "platform/speech/PlatformSpeechSynthesisUtterance.h" |
36 #include "platform/speech/PlatformSpeechSynthesizer.h" | 36 #include "platform/speech/PlatformSpeechSynthesizer.h" |
37 #include "wtf/Deque.h" | |
38 #include "wtf/PassRefPtr.h" | 37 #include "wtf/PassRefPtr.h" |
39 #include "wtf/RefCounted.h" | |
40 #include "wtf/RefPtr.h" | |
41 | 38 |
42 namespace WebCore { | 39 namespace WebCore { |
43 | 40 |
44 class ExceptionState; | 41 class ExceptionState; |
45 class PlatformSpeechSynthesizerClient; | 42 class PlatformSpeechSynthesizerClient; |
46 | 43 |
47 class SpeechSynthesis FINAL : public RefCountedWillBeGarbageCollectedFinalized<S
peechSynthesis>, public PlatformSpeechSynthesizerClient, public ScriptWrappable,
public ContextLifecycleObserver, public EventTargetWithInlineData { | 44 class SpeechSynthesis FINAL : public RefCountedGarbageCollectedWillBeGarbageColl
ectedFinalized<SpeechSynthesis>, public PlatformSpeechSynthesizerClient, public
ScriptWrappable, public ContextLifecycleObserver, public EventTargetWithInlineDa
ta { |
48 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCounted<SpeechSynthesis>)
; | 45 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<S
peechSynthesis>); |
49 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SpeechSynthesis); | 46 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SpeechSynthesis); |
50 public: | 47 public: |
51 static PassRefPtrWillBeRawPtr<SpeechSynthesis> create(ExecutionContext*); | 48 static SpeechSynthesis* create(ExecutionContext*); |
52 | 49 |
53 bool pending() const; | 50 bool pending() const; |
54 bool speaking() const; | 51 bool speaking() const; |
55 bool paused() const; | 52 bool paused() const; |
56 | 53 |
57 void speak(SpeechSynthesisUtterance*, ExceptionState&); | 54 void speak(SpeechSynthesisUtterance*, ExceptionState&); |
58 void cancel(); | 55 void cancel(); |
59 void pause(); | 56 void pause(); |
60 void resume(); | 57 void resume(); |
61 | 58 |
62 const WillBeHeapVector<RefPtrWillBeMember<SpeechSynthesisVoice> >& getVoices
(); | 59 const HeapVector<Member<SpeechSynthesisVoice> >& getVoices(); |
63 | 60 |
64 // Used in testing to use a mock platform synthesizer | 61 // Used in testing to use a mock platform synthesizer |
65 void setPlatformSynthesizer(PassOwnPtr<PlatformSpeechSynthesizer>); | 62 void setPlatformSynthesizer(PassOwnPtr<PlatformSpeechSynthesizer>); |
66 | 63 |
67 DEFINE_ATTRIBUTE_EVENT_LISTENER(voiceschanged); | 64 DEFINE_ATTRIBUTE_EVENT_LISTENER(voiceschanged); |
68 | 65 |
69 virtual ExecutionContext* executionContext() const OVERRIDE; | 66 virtual ExecutionContext* executionContext() const OVERRIDE; |
70 | 67 |
71 virtual void trace(Visitor*) OVERRIDE; | 68 virtual void trace(Visitor*) OVERRIDE; |
72 | 69 |
(...skipping 10 matching lines...) Expand all Loading... |
83 virtual void boundaryEventOccurred(PassRefPtr<PlatformSpeechSynthesisUtteran
ce>, SpeechBoundary, unsigned charIndex) OVERRIDE; | 80 virtual void boundaryEventOccurred(PassRefPtr<PlatformSpeechSynthesisUtteran
ce>, SpeechBoundary, unsigned charIndex) OVERRIDE; |
84 | 81 |
85 void startSpeakingImmediately(); | 82 void startSpeakingImmediately(); |
86 void handleSpeakingCompleted(SpeechSynthesisUtterance*, bool errorOccurred); | 83 void handleSpeakingCompleted(SpeechSynthesisUtterance*, bool errorOccurred); |
87 void fireEvent(const AtomicString& type, SpeechSynthesisUtterance*, unsigned
long charIndex, const String& name); | 84 void fireEvent(const AtomicString& type, SpeechSynthesisUtterance*, unsigned
long charIndex, const String& name); |
88 | 85 |
89 // Returns the utterance at the front of the queue. | 86 // Returns the utterance at the front of the queue. |
90 SpeechSynthesisUtterance* currentSpeechUtterance() const; | 87 SpeechSynthesisUtterance* currentSpeechUtterance() const; |
91 | 88 |
92 OwnPtr<PlatformSpeechSynthesizer> m_platformSpeechSynthesizer; | 89 OwnPtr<PlatformSpeechSynthesizer> m_platformSpeechSynthesizer; |
93 WillBeHeapVector<RefPtrWillBeMember<SpeechSynthesisVoice> > m_voiceList; | 90 HeapVector<Member<SpeechSynthesisVoice> > m_voiceList; |
94 Deque<RefPtrWillBeMember<SpeechSynthesisUtterance> > m_utteranceQueue; | 91 HeapDeque<Member<SpeechSynthesisUtterance> > m_utteranceQueue; |
95 bool m_isPaused; | 92 bool m_isPaused; |
96 | 93 |
97 // EventTarget | 94 // EventTarget |
98 virtual const AtomicString& interfaceName() const OVERRIDE; | 95 virtual const AtomicString& interfaceName() const OVERRIDE; |
99 }; | 96 }; |
100 | 97 |
101 } // namespace WebCore | 98 } // namespace WebCore |
102 | 99 |
103 #endif // SpeechSynthesisEvent_h | 100 #endif // SpeechSynthesisEvent_h |
OLD | NEW |