OLD | NEW |
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 /** | 5 /** |
6 * @fileoverview A class for managing all enumerated gnubby devices. | 6 * @fileoverview A class for managing all enumerated gnubby devices. |
7 */ | 7 */ |
8 'use strict'; | 8 'use strict'; |
9 | 9 |
10 /** | 10 /** |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 var cb = self.pendingEnumerate.shift(); | 206 var cb = self.pendingEnumerate.shift(); |
207 cb(-GnubbyDevice.OK, existingDeviceIds); | 207 cb(-GnubbyDevice.OK, existingDeviceIds); |
208 } | 208 } |
209 } | 209 } |
210 } | 210 } |
211 | 211 |
212 var deviceIds = []; | 212 var deviceIds = []; |
213 function makeEnumerateCb(namespace) { | 213 function makeEnumerateCb(namespace) { |
214 return function(devs) { | 214 return function(devs) { |
215 enumerated(namespace, deviceIds, devs); | 215 enumerated(namespace, deviceIds, devs); |
216 } | 216 }; |
217 } | 217 } |
218 | 218 |
219 this.pendingEnumerate.push(cb); | 219 this.pendingEnumerate.push(cb); |
220 if (this.pendingEnumerate.length == 1) { | 220 if (this.pendingEnumerate.length == 1) { |
221 for (var i = 0; i < this.namespaces_.length; i++) { | 221 for (var i = 0; i < this.namespaces_.length; i++) { |
222 var namespace = this.namespaces_[i]; | 222 var namespace = this.namespaces_[i]; |
223 var enumerator = this.impl_[namespace].enumerate; | 223 var enumerator = this.impl_[namespace].enumerate; |
224 enumerator(makeEnumerateCb(namespace), opt_type); | 224 enumerator(makeEnumerateCb(namespace), opt_type); |
225 } | 225 } |
226 } | 226 } |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 if (whichDev && dev != whichDev) { | 413 if (whichDev && dev != whichDev) { |
414 console.warn('Gnubby attached to more than one device!?'); | 414 console.warn('Gnubby attached to more than one device!?'); |
415 } | 415 } |
416 if (!dev.deregisterClient(who)) { | 416 if (!dev.deregisterClient(who)) { |
417 dev.destroy(); | 417 dev.destroy(); |
418 } | 418 } |
419 } | 419 } |
420 } | 420 } |
421 } | 421 } |
422 }; | 422 }; |
OLD | NEW |