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

Unified Diff: chrome/browser/resources/cryptotoken/llhidgnubby.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
Index: chrome/browser/resources/cryptotoken/llhidgnubby.js
diff --git a/chrome/browser/resources/cryptotoken/llhidgnubby.js b/chrome/browser/resources/cryptotoken/llhidgnubby.js
index 0f643bb880f6dd0f8dbbaf10926868a0d1ff7454..0587c5e50929167be5335fd4beac6f860adfdde5 100644
--- a/chrome/browser/resources/cryptotoken/llhidgnubby.js
+++ b/chrome/browser/resources/cryptotoken/llhidgnubby.js
@@ -40,6 +40,8 @@ llHidGnubby.NAMESPACE = 'hid';
llHidGnubby.prototype.destroy = function() {
if (!this.dev) return; // Already dead.
+ this.gnubbies_.removeOpenDevice(
+ {namespace: llHidGnubby.NAMESPACE, device: this.id});
this.closing = true;
console.log(UTIL_fmt('llHidGnubby.destroy()'));
@@ -68,15 +70,9 @@ llHidGnubby.prototype.destroy = function() {
var dev = this.dev;
this.dev = null;
- var self = this;
-
- function onClosed() {
+ chrome.hid.disconnect(dev.connectionId, function() {
console.log(UTIL_fmt('Device ' + dev.handle + ' closed'));
- self.gnubbies_.removeOpenDevice(
- {namespace: llHidGnubby.NAMESPACE, device: self.id});
- }
-
- chrome.hid.disconnect(dev.connectionId, onClosed);
+ });
};
/**
@@ -104,17 +100,6 @@ llHidGnubby.prototype.publishFrame_ = function(f) {
};
/**
- * @return {boolean} whether this device is open and ready to use.
- * @private
- */
-llHidGnubby.prototype.readyToUse_ = function() {
- if (this.closing) return false;
- if (!this.dev) return false;
-
- return true;
-};
-
-/**
* Register a client for this gnubby.
* @param {*} who The client.
*/
@@ -299,7 +284,7 @@ llHidGnubby.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 arguments
+ * @param {ArrayBuffer|Uint8Array} data Command arguments
*/
llHidGnubby.prototype.queueCommand = function(cid, cmd, data) {
if (!this.dev) return;
« no previous file with comments | « chrome/browser/resources/cryptotoken/llgnubby.js ('k') | chrome/browser/resources/cryptotoken/llusbgnubby.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698