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

Unified Diff: chrome/browser/resources/cryptotoken/llusbgnubby.js

Issue 308173002: Fix race and remove unused features in cryptotoken extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix type annotation Created 6 years, 7 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 | « chrome/browser/resources/cryptotoken/llhidgnubby.js ('k') | chrome/browser/resources/cryptotoken/signer.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/cryptotoken/llusbgnubby.js
diff --git a/chrome/browser/resources/cryptotoken/llusbgnubby.js b/chrome/browser/resources/cryptotoken/llusbgnubby.js
index 624af6464051b54ae2978bc99d1618755c9a0eb7..49fb371729c2632e94c508ca50131d022f69c13e 100644
--- a/chrome/browser/resources/cryptotoken/llusbgnubby.js
+++ b/chrome/browser/resources/cryptotoken/llusbgnubby.js
@@ -46,6 +46,8 @@ llUsbGnubby.NAMESPACE = 'usb';
llUsbGnubby.prototype.destroy = function() {
if (!this.dev) return; // Already dead.
+ this.gnubbies_.removeOpenDevice(
+ {namespace: llUsbGnubby.NAMESPACE, device: this.id});
this.closing = true;
console.log(UTIL_fmt('llUsbGnubby.destroy()'));
@@ -74,18 +76,11 @@ llUsbGnubby.prototype.destroy = function() {
var dev = this.dev;
this.dev = null;
- var self = this;
-
- function onClosed() {
- console.log(UTIL_fmt('Device ' + dev.handle + ' closed'));
- self.gnubbies_.removeOpenDevice(
- {namespace: llUsbGnubby.NAMESPACE, device: self.id});
- }
-
- // Release first.
chrome.usb.releaseInterface(dev, 0, function() {
console.log(UTIL_fmt('Device ' + dev.handle + ' released'));
- chrome.usb.closeDevice(dev, onClosed);
+ chrome.usb.closeDevice(dev, function() {
+ console.log(UTIL_fmt('Device ' + dev.handle + ' closed'));
+ });
});
};
@@ -343,7 +338,7 @@ llUsbGnubby.prototype.updateLock_ = function(cid, cmd, arg) {
* If queue was empty, initiate the write.
* @param {number} cid The client's channel ID.
* @param {number} cmd The command to send.
- * @param {ArrayBuffer} data Command argument data
+ * @param {ArrayBuffer|Uint8Array} data Command argument data
*/
llUsbGnubby.prototype.queueCommand = function(cid, cmd, data) {
if (!this.dev) return;
« no previous file with comments | « chrome/browser/resources/cryptotoken/llhidgnubby.js ('k') | chrome/browser/resources/cryptotoken/signer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698