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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('hotword', function() { 5 cr.define('hotword', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Class used to manage the state of the NaCl recognizer plugin. Handles all 9 * Class used to manage the state of the NaCl recognizer plugin. Handles all
10 * control of the NaCl plugin, including creation, start, stop, trigger, and 10 * control of the NaCl plugin, including creation, start, stop, trigger, and
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } else { 165 } else {
166 throw 'Attempting to start NaCl recogniser not in STOPPED or STOPPING ' + 166 throw 'Attempting to start NaCl recogniser not in STOPPED or STOPPING ' +
167 'state'; 167 'state';
168 } 168 }
169 }; 169 };
170 170
171 /** 171 /**
172 * Stops the hotword recognizer. 172 * Stops the hotword recognizer.
173 */ 173 */
174 NaClManager.prototype.stopRecognizer = function() { 174 NaClManager.prototype.stopRecognizer = function() {
175 if (this.recognizerState_ == ManagerState_.STARTING) {
176 // If the recognizer is stopped before it finishes starting, it causes an
177 // assertion to be raised in waitForMessage_() since we're waiting for the
178 // READY_FOR_AUDIO message. Clear the current timeout and expecting message
179 // since we no longer expect it and may never receive it.
180 this.clearTimeout_();
181 this.expectingMessage_ = null;
182 }
175 this.sendDataToPlugin_(hotword.constants.NaClPlugin.STOP); 183 this.sendDataToPlugin_(hotword.constants.NaClPlugin.STOP);
176 this.recognizerState_ = ManagerState_.STOPPING; 184 this.recognizerState_ = ManagerState_.STOPPING;
177 this.waitForMessage_(hotword.constants.TimeoutMs.NORMAL, 185 this.waitForMessage_(hotword.constants.TimeoutMs.NORMAL,
178 hotword.constants.NaClPlugin.STOPPED); 186 hotword.constants.NaClPlugin.STOPPED);
179 }; 187 };
180 188
181 /** 189 /**
182 * Checks whether the file at the given path exists. 190 * Checks whether the file at the given path exists.
183 * @param {!string} path Path to a file. Can be any valid URL. 191 * @param {!string} path Path to a file. Can be any valid URL.
184 * @return {boolean} True if the patch exists. 192 * @return {boolean} True if the patch exists.
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 break; 511 break;
504 } 512 }
505 } 513 }
506 }; 514 };
507 515
508 return { 516 return {
509 NaClManager: NaClManager 517 NaClManager: NaClManager
510 }; 518 };
511 519
512 }); 520 });
OLDNEW
« 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