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

Unified Diff: chrome/browser/resources/chromeos/chromevox/host/chrome/tts_background.js

Issue 2570593002: Improve the speech panel's performance (Closed)
Patch Set: Created 4 years 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: chrome/browser/resources/chromeos/chromevox/host/chrome/tts_background.js
diff --git a/chrome/browser/resources/chromeos/chromevox/host/chrome/tts_background.js b/chrome/browser/resources/chromeos/chromevox/host/chrome/tts_background.js
index be031a9bf8d780ea4cbd1b544d4f2996d5add30d..d4d37045800bd407ec89f329b594cc5db0819ec2 100644
--- a/chrome/browser/resources/chromeos/chromevox/host/chrome/tts_background.js
+++ b/chrome/browser/resources/chromeos/chromevox/host/chrome/tts_background.js
@@ -303,19 +303,6 @@ cvox.TtsBackground.prototype.speakUsingQueue_ = function(utterance, queueMode) {
// Next, add the new utterance to the queue.
this.utteranceQueue_.push(utterance);
- // Update the caption panel.
- if (utterance.properties &&
- utterance.properties['pitch'] &&
- utterance.properties['pitch'] < this.ttsProperties['pitch']) {
- (new PanelCommand(
- PanelCommandType.ADD_ANNOTATION_SPEECH,
- utterance.textString)).send();
- } else {
- (new PanelCommand(
- PanelCommandType.ADD_NORMAL_SPEECH,
- utterance.textString)).send();
- }
-
// Now start speaking the next item in the queue.
this.startSpeakingNextItemInQueue_();
};
@@ -342,9 +329,10 @@ cvox.TtsBackground.prototype.startSpeakingNextItemInQueue_ = function() {
}
this.currentUtterance_ = this.utteranceQueue_.shift();
- var utteranceId = this.currentUtterance_.id;
+ var utterance = this.currentUtterance_;
+ var utteranceId = utterance.id;
- this.currentUtterance_.properties['onEvent'] = goog.bind(function(event) {
+ utterance.properties['onEvent'] = goog.bind(function(event) {
this.onTtsEvent_(event, utteranceId);
},
this);
@@ -352,13 +340,25 @@ cvox.TtsBackground.prototype.startSpeakingNextItemInQueue_ = function() {
var validatedProperties = {};
for (var i = 0; i < cvox.TtsBackground.ALLOWED_PROPERTIES_.length; i++) {
var p = cvox.TtsBackground.ALLOWED_PROPERTIES_[i];
- if (this.currentUtterance_.properties[p]) {
- validatedProperties[p] = this.currentUtterance_.properties[p];
+ if (utterance.properties[p]) {
+ validatedProperties[p] = utterance.properties[p];
}
}
- chrome.tts.speak(this.currentUtterance_.textString,
- validatedProperties);
+ // Update the caption panel.
+ if (utterance.properties &&
+ utterance.properties['pitch'] &&
+ utterance.properties['pitch'] < this.ttsProperties['pitch']) {
+ (new PanelCommand(
+ PanelCommandType.ADD_ANNOTATION_SPEECH,
+ utterance.textString)).send();
+ } else {
+ (new PanelCommand(
+ PanelCommandType.ADD_NORMAL_SPEECH,
+ utterance.textString)).send();
+ }
+
+ chrome.tts.speak(utterance.textString, validatedProperties);
};
/**
« 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