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

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: 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..df9edebe210b78befa9b0afa520a79af676fe653 100644
--- a/Source/modules/speech/SpeechSynthesis.cpp
+++ b/Source/modules/speech/SpeechSynthesis.cpp
@@ -154,10 +154,12 @@ void SpeechSynthesis::handleSpeakingCompleted(SpeechSynthesisUtterance* utteranc
ASSERT(utterance);
bool didJustFinishCurrentUtterance = false;
+ int oldQueueSize = 0;
haraken 2014/08/21 01:01:22 Can we introduce something like a |shouldStartSpea
// 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();
+ oldQueueSize = m_utteranceQueue.size();
didJustFinishCurrentUtterance = true;
}
@@ -168,7 +170,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 (didJustFinishCurrentUtterance && !m_utteranceQueue.isEmpty() && oldQueueSize)
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