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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 virtual void pause(); | 73 virtual void pause(); |
74 virtual void resume(); | 74 virtual void resume(); |
75 virtual void cancel(); | 75 virtual void cancel(); |
76 | 76 |
77 PlatformSpeechSynthesizerClient* client() const { | 77 PlatformSpeechSynthesizerClient* client() const { |
78 return m_speechSynthesizerClient; | 78 return m_speechSynthesizerClient; |
79 } | 79 } |
80 | 80 |
81 void setVoiceList(Vector<RefPtr<PlatformSpeechSynthesisVoice>>&); | 81 void setVoiceList(Vector<RefPtr<PlatformSpeechSynthesisVoice>>&); |
82 | 82 |
83 // Eager finalization is required to promptly release the owned WebSpeechSynth
esizer. | 83 // Eager finalization is required to promptly release the owned |
| 84 // WebSpeechSynthesizer. |
84 // | 85 // |
85 // If not and delayed until lazily swept, m_webSpeechSynthesizerClient may end
up | 86 // If not and delayed until lazily swept, m_webSpeechSynthesizerClient may end |
86 // being lazily swept first (i.e., before this PlatformSpeechSynthesizer), lea
ving | 87 // up being lazily swept first (i.e., before this PlatformSpeechSynthesizer), |
87 // m_webSpeechSynthesizer with a dangling pointer to a finalized object -- | 88 // leaving m_webSpeechSynthesizer with a dangling pointer to a finalized |
88 // WebSpeechSynthesizer embedder implementations calling notification methods
in the | 89 // object -- WebSpeechSynthesizer embedder implementations calling |
89 // other directions by way of m_webSpeechSynthesizerClient. Eagerly releasing | 90 // notification methods in the other directions by way of |
90 // WebSpeechSynthesizer prevents such unsafe accesses. | 91 // m_webSpeechSynthesizerClient. Eagerly releasing WebSpeechSynthesizer |
| 92 // prevents such unsafe accesses. |
91 EAGERLY_FINALIZE(); | 93 EAGERLY_FINALIZE(); |
92 DECLARE_VIRTUAL_TRACE(); | 94 DECLARE_VIRTUAL_TRACE(); |
93 | 95 |
94 protected: | 96 protected: |
95 explicit PlatformSpeechSynthesizer(PlatformSpeechSynthesizerClient*); | 97 explicit PlatformSpeechSynthesizer(PlatformSpeechSynthesizerClient*); |
96 | 98 |
97 virtual void initializeVoiceList(); | 99 virtual void initializeVoiceList(); |
98 | 100 |
99 Vector<RefPtr<PlatformSpeechSynthesisVoice>> m_voiceList; | 101 Vector<RefPtr<PlatformSpeechSynthesisVoice>> m_voiceList; |
100 | 102 |
101 private: | 103 private: |
102 Member<PlatformSpeechSynthesizerClient> m_speechSynthesizerClient; | 104 Member<PlatformSpeechSynthesizerClient> m_speechSynthesizerClient; |
103 | 105 |
104 std::unique_ptr<WebSpeechSynthesizer> m_webSpeechSynthesizer; | 106 std::unique_ptr<WebSpeechSynthesizer> m_webSpeechSynthesizer; |
105 Member<WebSpeechSynthesizerClientImpl> m_webSpeechSynthesizerClient; | 107 Member<WebSpeechSynthesizerClientImpl> m_webSpeechSynthesizerClient; |
106 }; | 108 }; |
107 | 109 |
108 } // namespace blink | 110 } // namespace blink |
109 | 111 |
110 #endif // PlatformSpeechSynthesizer_h | 112 #endif // PlatformSpeechSynthesizer_h |
OLD | NEW |