OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2013 Apple Computer, 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 virtual ~PlatformSpeechSynthesizerClient() { } | 56 virtual ~PlatformSpeechSynthesizerClient() { } |
57 }; | 57 }; |
58 | 58 |
59 class PLATFORM_EXPORT PlatformSpeechSynthesizer : public GarbageCollectedFinaliz
ed<PlatformSpeechSynthesizer> { | 59 class PLATFORM_EXPORT PlatformSpeechSynthesizer : public GarbageCollectedFinaliz
ed<PlatformSpeechSynthesizer> { |
60 WTF_MAKE_NONCOPYABLE(PlatformSpeechSynthesizer); | 60 WTF_MAKE_NONCOPYABLE(PlatformSpeechSynthesizer); |
61 public: | 61 public: |
62 static PlatformSpeechSynthesizer* create(PlatformSpeechSynthesizerClient*); | 62 static PlatformSpeechSynthesizer* create(PlatformSpeechSynthesizerClient*); |
63 | 63 |
64 virtual ~PlatformSpeechSynthesizer(); | 64 virtual ~PlatformSpeechSynthesizer(); |
65 | 65 |
66 const HeapVector<Member<PlatformSpeechSynthesisVoice>>& voiceList() const {
return m_voiceList; } | 66 const Vector<RefPtr<PlatformSpeechSynthesisVoice>>& voiceList() const { retu
rn m_voiceList; } |
67 virtual void speak(PlatformSpeechSynthesisUtterance*); | 67 virtual void speak(PlatformSpeechSynthesisUtterance*); |
68 virtual void pause(); | 68 virtual void pause(); |
69 virtual void resume(); | 69 virtual void resume(); |
70 virtual void cancel(); | 70 virtual void cancel(); |
71 | 71 |
72 PlatformSpeechSynthesizerClient* client() const { return m_speechSynthesizer
Client; } | 72 PlatformSpeechSynthesizerClient* client() const { return m_speechSynthesizer
Client; } |
73 | 73 |
74 void setVoiceList(HeapVector<Member<PlatformSpeechSynthesisVoice>>&); | 74 void setVoiceList(Vector<RefPtr<PlatformSpeechSynthesisVoice>>&); |
75 | 75 |
76 // Eager finalization is required to promptly release the owned WebSpeechSyn
thesizer. | 76 // Eager finalization is required to promptly release the owned WebSpeechSyn
thesizer. |
77 // | 77 // |
78 // If not and delayed until lazily swept, m_webSpeechSynthesizerClient may e
nd up | 78 // If not and delayed until lazily swept, m_webSpeechSynthesizerClient may e
nd up |
79 // being lazily swept first (i.e., before this PlatformSpeechSynthesizer), l
eaving | 79 // being lazily swept first (i.e., before this PlatformSpeechSynthesizer), l
eaving |
80 // m_webSpeechSynthesizer with a dangling pointer to a finalized object -- | 80 // m_webSpeechSynthesizer with a dangling pointer to a finalized object -- |
81 // WebSpeechSynthesizer embedder implementations calling notification method
s in the | 81 // WebSpeechSynthesizer embedder implementations calling notification method
s in the |
82 // other directions by way of m_webSpeechSynthesizerClient. Eagerly releasin
g | 82 // other directions by way of m_webSpeechSynthesizerClient. Eagerly releasin
g |
83 // WebSpeechSynthesizer prevents such unsafe accesses. | 83 // WebSpeechSynthesizer prevents such unsafe accesses. |
84 EAGERLY_FINALIZE(); | 84 EAGERLY_FINALIZE(); |
85 DECLARE_VIRTUAL_TRACE(); | 85 DECLARE_VIRTUAL_TRACE(); |
86 | 86 |
87 protected: | 87 protected: |
88 explicit PlatformSpeechSynthesizer(PlatformSpeechSynthesizerClient*); | 88 explicit PlatformSpeechSynthesizer(PlatformSpeechSynthesizerClient*); |
89 | 89 |
90 virtual void initializeVoiceList(); | 90 virtual void initializeVoiceList(); |
91 | 91 |
92 HeapVector<Member<PlatformSpeechSynthesisVoice>> m_voiceList; | 92 Vector<RefPtr<PlatformSpeechSynthesisVoice>> m_voiceList; |
93 | 93 |
94 private: | 94 private: |
95 Member<PlatformSpeechSynthesizerClient> m_speechSynthesizerClient; | 95 Member<PlatformSpeechSynthesizerClient> m_speechSynthesizerClient; |
96 | 96 |
97 OwnPtr<WebSpeechSynthesizer> m_webSpeechSynthesizer; | 97 OwnPtr<WebSpeechSynthesizer> m_webSpeechSynthesizer; |
98 Member<WebSpeechSynthesizerClientImpl> m_webSpeechSynthesizerClient; | 98 Member<WebSpeechSynthesizerClientImpl> m_webSpeechSynthesizerClient; |
99 }; | 99 }; |
100 | 100 |
101 } // namespace blink | 101 } // namespace blink |
102 | 102 |
103 #endif // PlatformSpeechSynthesizer_h | 103 #endif // PlatformSpeechSynthesizer_h |
OLD | NEW |