Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2508)

Unified Diff: Source/modules/speech/SpeechSynthesis.cpp

Issue 495603002: Add checking queue size when calling handleSpeakingCompleted(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add new flag "shouldStartSpeaking" and remove flag "didJustFinishCurrentUtterance" Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/speech/SpeechSynthesis.cpp
diff --git a/Source/modules/speech/SpeechSynthesis.cpp b/Source/modules/speech/SpeechSynthesis.cpp
index 363ea98d9b61ad5827bb5219818c8e2ed56933a5..2aec9f1a36cea31c44185551859e95722cc1f789 100644
--- a/Source/modules/speech/SpeechSynthesis.cpp
+++ b/Source/modules/speech/SpeechSynthesis.cpp
@@ -153,12 +153,12 @@ void SpeechSynthesis::handleSpeakingCompleted(SpeechSynthesisUtterance* utteranc
{
ASSERT(utterance);
- bool didJustFinishCurrentUtterance = false;
+ bool shouldStartSpeaking = false;
// If the utterance that completed was the one we're currently speaking,
// remove it from the queue and start speaking the next one.
if (utterance == currentSpeechUtterance()) {
m_utteranceQueue.removeFirst();
- didJustFinishCurrentUtterance = true;
+ shouldStartSpeaking = !!m_utteranceQueue.size();
}
// Always fire the event, because the platform may have asynchronously
@@ -168,7 +168,7 @@ void SpeechSynthesis::handleSpeakingCompleted(SpeechSynthesisUtterance* utteranc
fireEvent(errorOccurred ? EventTypeNames::error : EventTypeNames::end, utterance, 0, String());
// Start the next utterance if we just finished one and one was pending.
- if (didJustFinishCurrentUtterance && !m_utteranceQueue.isEmpty() && !utterance->startTime())
+ if (shouldStartSpeaking && !m_utteranceQueue.isEmpty())
startSpeakingImmediately();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698