[webkit-changes] [WebKit/WebKit] 75a01d: Keep SpeechSynthesisUtterance wrapper alive when u...
Sihui
noreply at github.com
Tue Aug 22 16:44:40 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 75a01d7e9d12969c5a2b878a6c4c572c9e6fbf27
https://github.com/WebKit/WebKit/commit/75a01d7e9d12969c5a2b878a6c4c572c9e6fbf27
Author: Sihui Liu <sihui_liu at apple.com>
Date: 2023-08-22 (Tue, 22 Aug 2023)
Changed paths:
A LayoutTests/fast/speechsynthesis/speech-synthesis-utterance-gc-expected.txt
A LayoutTests/fast/speechsynthesis/speech-synthesis-utterance-gc.html
M Source/WebCore/Modules/speech/SpeechSynthesis.cpp
M Source/WebCore/Modules/speech/SpeechSynthesis.h
M Source/WebCore/Modules/speech/SpeechSynthesisUtterance.cpp
M Source/WebCore/Modules/speech/SpeechSynthesisUtterance.h
Log Message:
-----------
Keep SpeechSynthesisUtterance wrapper alive when utterance is spoken multiple times
https://bugs.webkit.org/show_bug.cgi?id=260474
rdar://114203537
Reviewed by Ryosuke Niwa.
In 266959 at main and 266990 at main, we make sure wrapper of SpeechSynthesisUtterance is kept alive when it is being
processed. The "alive" period starts from when SpeechSynthesisUtterance is handed to SpeechSynthesis via speak(), and
ends when SpeechSynthesisUtterance receives end events or SpeechSynthesisUtterance is removed from SpeechSynthesis.
According to existing wpt test SpeechSynthesis-speak-twice.html, it is valid to speak an utterance multiple times, i.e.
same utterance can be handed to SpeechSynthesis multiple times, so we should make sure SpeechSynthesisUtterance is kept
alive until the last speaking is finished.
* LayoutTests/fast/speechsynthesis/speech-synthesis-utterance-gc-expected.txt: Added.
* LayoutTests/fast/speechsynthesis/speech-synthesis-utterance-gc.html: Added.
* Source/WebCore/Modules/speech/SpeechSynthesis.cpp:
(WebCore::SpeechSynthesis::setPlatformSynthesizer):
(WebCore::SpeechSynthesis::speaking const):
(WebCore::SpeechSynthesis::startSpeakingImmediately):
(WebCore::SpeechSynthesis::speak):
(WebCore::SpeechSynthesis::cancel):
(WebCore::SpeechSynthesis::didStartSpeaking):
(WebCore::SpeechSynthesis::didFinishSpeaking):
(WebCore::SpeechSynthesis::didPauseSpeaking):
(WebCore::SpeechSynthesis::didResumeSpeaking):
(WebCore::SpeechSynthesis::speakingErrorOccurred):
(WebCore::SpeechSynthesis::boundaryEventOccurred):
(WebCore::SpeechSynthesis::protectedCurrentSpeechUtterance):
(WebCore::SpeechSynthesis::clearUtteranceQueue): Deleted.
* Source/WebCore/Modules/speech/SpeechSynthesis.h:
* Source/WebCore/Modules/speech/SpeechSynthesisUtterance.cpp:
(WebCore::SpeechSynthesisUtterance::eventOccurred):
(WebCore::SpeechSynthesisUtterance::errorEventOccurred):
(WebCore::SpeechSynthesisUtterance::incrementActivityCountForEventDispatch):
(WebCore::SpeechSynthesisUtterance::decrementActivityCountForEventDispatch):
(WebCore::SpeechSynthesisUtterance::virtualHasPendingActivity const):
(WebCore::SpeechSynthesisUtterance::dispatchEventAndUpdateState): Deleted.
(WebCore::SpeechSynthesisUtterance::setIsActiveForEventDispatch): Deleted.
* Source/WebCore/Modules/speech/SpeechSynthesisUtterance.h:
(WebCore::SpeechSynthesisUtteranceActivity::SpeechSynthesisUtteranceActivity):
(WebCore::SpeechSynthesisUtteranceActivity::~SpeechSynthesisUtteranceActivity):
(WebCore::SpeechSynthesisUtteranceActivity::utterance):
Canonical link: https://commits.webkit.org/267161@main
More information about the webkit-changes
mailing list