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

Unified Diff: chrome/browser/resources/hotword/nacl_manager.js

Issue 737193002: Fix assertion error when NaCl detector is stopped immediately after starting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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/hotword/nacl_manager.js
diff --git a/chrome/browser/resources/hotword/nacl_manager.js b/chrome/browser/resources/hotword/nacl_manager.js
index 8236e552bd30649fce6a7c4c07174f7b2b742b79..28daae9c3d6299d3c7a8b4921cfa164602a3a722 100644
--- a/chrome/browser/resources/hotword/nacl_manager.js
+++ b/chrome/browser/resources/hotword/nacl_manager.js
@@ -172,6 +172,14 @@ NaClManager.prototype.startRecognizer = function() {
* Stops the hotword recognizer.
*/
NaClManager.prototype.stopRecognizer = function() {
+ if (this.recognizerState_ == ManagerState_.STARTING) {
+ // If the recognizer is stopped before it finishes starting, it causes an
+ // assertion to be raised in waitForMessage_() since we're waiting for the
+ // READY_FOR_AUDIO message. Clear the current timeout and expecting message
+ // since we no longer expect it and may never receive it.
+ this.clearTimeout_();
+ this.expectingMessage_ = null;
+ }
this.sendDataToPlugin_(hotword.constants.NaClPlugin.STOP);
this.recognizerState_ = ManagerState_.STOPPING;
this.waitForMessage_(hotword.constants.TimeoutMs.NORMAL,
« 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