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 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/PassRefPtr.h" | |
| 38 | 37 |
| 39 namespace WebCore { | 38 namespace WebCore { |
| 40 | 39 |
| 41 class ExceptionState; | 40 class ExceptionState; |
| 42 class PlatformSpeechSynthesizerClient; | 41 class PlatformSpeechSynthesizerClient; |
| 43 | 42 |
| 44 class SpeechSynthesis FINAL : public RefCountedGarbageCollectedWillBeGarbageColl ectedFinalized<SpeechSynthesis>, public PlatformSpeechSynthesizerClient, public ScriptWrappable, public ContextLifecycleObserver, public EventTargetWithInlineDa ta { | 43 class SpeechSynthesis FINAL : public RefCountedGarbageCollectedWillBeGarbageColl ectedFinalized<SpeechSynthesis>, public PlatformSpeechSynthesizerClient, public ScriptWrappable, public ContextLifecycleObserver, public EventTargetWithInlineDa ta { |
| 45 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<S peechSynthesis>); | 44 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<S peechSynthesis>); |
| 46 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SpeechSynthesis); | 45 USING_GARBAGE_COLLECTED_MIXIN(SpeechSynthesis); |
|
haraken
2014/06/17 09:18:50
I'm a bit confused with this. You didn't drop WILL
sof
2014/06/17 09:26:08
PlatformSpeechSynthesizerClient is on the heap alw
haraken
2014/06/17 09:30:23
Makes sense. If either of mixins is on the heap al
| |
| 47 public: | 46 public: |
| 48 static SpeechSynthesis* create(ExecutionContext*); | 47 static SpeechSynthesis* create(ExecutionContext*); |
| 49 | 48 |
| 50 bool pending() const; | 49 bool pending() const; |
| 51 bool speaking() const; | 50 bool speaking() const; |
| 52 bool paused() const; | 51 bool paused() const; |
| 53 | 52 |
| 54 void speak(SpeechSynthesisUtterance*, ExceptionState&); | 53 void speak(SpeechSynthesisUtterance*, ExceptionState&); |
| 55 void cancel(); | 54 void cancel(); |
| 56 void pause(); | 55 void pause(); |
| 57 void resume(); | 56 void resume(); |
| 58 | 57 |
| 59 const HeapVector<Member<SpeechSynthesisVoice> >& getVoices(); | 58 const HeapVector<Member<SpeechSynthesisVoice> >& getVoices(); |
| 60 | 59 |
| 61 // Used in testing to use a mock platform synthesizer | 60 // Used in testing to use a mock platform synthesizer |
| 62 void setPlatformSynthesizer(PassOwnPtr<PlatformSpeechSynthesizer>); | 61 void setPlatformSynthesizer(PlatformSpeechSynthesizer*); |
| 63 | 62 |
| 64 DEFINE_ATTRIBUTE_EVENT_LISTENER(voiceschanged); | 63 DEFINE_ATTRIBUTE_EVENT_LISTENER(voiceschanged); |
| 65 | 64 |
| 66 virtual ExecutionContext* executionContext() const OVERRIDE; | 65 virtual ExecutionContext* executionContext() const OVERRIDE; |
| 67 | 66 |
| 68 virtual void trace(Visitor*) OVERRIDE; | 67 virtual void trace(Visitor*) OVERRIDE; |
| 69 | 68 |
| 70 private: | 69 private: |
| 71 explicit SpeechSynthesis(ExecutionContext*); | 70 explicit SpeechSynthesis(ExecutionContext*); |
| 72 | 71 |
| 73 // PlatformSpeechSynthesizerClient override methods. | 72 // PlatformSpeechSynthesizerClient override methods. |
| 74 virtual void voicesDidChange() OVERRIDE; | 73 virtual void voicesDidChange() OVERRIDE; |
| 75 virtual void didStartSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>) OVERRIDE; | 74 virtual void didStartSpeaking(PlatformSpeechSynthesisUtterance*) OVERRIDE; |
| 76 virtual void didPauseSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>) OVERRIDE; | 75 virtual void didPauseSpeaking(PlatformSpeechSynthesisUtterance*) OVERRIDE; |
| 77 virtual void didResumeSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>) OVERRIDE; | 76 virtual void didResumeSpeaking(PlatformSpeechSynthesisUtterance*) OVERRIDE; |
| 78 virtual void didFinishSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>) OVERRIDE; | 77 virtual void didFinishSpeaking(PlatformSpeechSynthesisUtterance*) OVERRIDE; |
| 79 virtual void speakingErrorOccurred(PassRefPtr<PlatformSpeechSynthesisUtteran ce>) OVERRIDE; | 78 virtual void speakingErrorOccurred(PlatformSpeechSynthesisUtterance*) OVERRI DE; |
| 80 virtual void boundaryEventOccurred(PassRefPtr<PlatformSpeechSynthesisUtteran ce>, SpeechBoundary, unsigned charIndex) OVERRIDE; | 79 virtual void boundaryEventOccurred(PlatformSpeechSynthesisUtterance*, Speech Boundary, unsigned charIndex) OVERRIDE; |
| 81 | 80 |
| 82 void startSpeakingImmediately(); | 81 void startSpeakingImmediately(); |
| 83 void handleSpeakingCompleted(SpeechSynthesisUtterance*, bool errorOccurred); | 82 void handleSpeakingCompleted(SpeechSynthesisUtterance*, bool errorOccurred); |
| 84 void fireEvent(const AtomicString& type, SpeechSynthesisUtterance*, unsigned long charIndex, const String& name); | 83 void fireEvent(const AtomicString& type, SpeechSynthesisUtterance*, unsigned long charIndex, const String& name); |
| 85 | 84 |
| 86 // Returns the utterance at the front of the queue. | 85 // Returns the utterance at the front of the queue. |
| 87 SpeechSynthesisUtterance* currentSpeechUtterance() const; | 86 SpeechSynthesisUtterance* currentSpeechUtterance() const; |
| 88 | 87 |
| 89 OwnPtr<PlatformSpeechSynthesizer> m_platformSpeechSynthesizer; | 88 Member<PlatformSpeechSynthesizer> m_platformSpeechSynthesizer; |
| 90 HeapVector<Member<SpeechSynthesisVoice> > m_voiceList; | 89 HeapVector<Member<SpeechSynthesisVoice> > m_voiceList; |
| 91 HeapDeque<Member<SpeechSynthesisUtterance> > m_utteranceQueue; | 90 HeapDeque<Member<SpeechSynthesisUtterance> > m_utteranceQueue; |
| 92 bool m_isPaused; | 91 bool m_isPaused; |
| 93 | 92 |
| 94 // EventTarget | 93 // EventTarget |
| 95 virtual const AtomicString& interfaceName() const OVERRIDE; | 94 virtual const AtomicString& interfaceName() const OVERRIDE; |
| 96 }; | 95 }; |
| 97 | 96 |
| 98 } // namespace WebCore | 97 } // namespace WebCore |
| 99 | 98 |
| 100 #endif // SpeechSynthesisEvent_h | 99 #endif // SpeechSynthesisEvent_h |
| OLD | NEW |