| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef DEVICE_USB_USB_DEVICE_HANDLE_USBFS_H_ | 5 #ifndef DEVICE_USB_USB_DEVICE_HANDLE_USBFS_H_ |
| 6 #define DEVICE_USB_USB_DEVICE_HANDLE_USBFS_H_ | 6 #define DEVICE_USB_USB_DEVICE_HANDLE_USBFS_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/files/scoped_file.h" | 13 #include "base/files/scoped_file.h" |
| 14 #include "device/usb/usb_device_handle.h" | 14 #include "device/usb/usb_device_handle.h" |
| 15 | 15 |
| 16 struct usbdevfs_urb; | 16 struct usbdevfs_urb; |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 class SequencedTaskRunner; | 19 class SequencedTaskRunner; |
| 20 class SingleThreadTaskRunner; | 20 class SingleThreadTaskRunner; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace device { | 23 namespace device { |
| 24 | 24 |
| 25 // Implementation of a USB device handle on top of the Linux USBFS ioctl | 25 // Implementation of a USB device handle on top of the Linux USBFS ioctl |
| 26 // interface available on Linux, Chrome OS and Android. | 26 // interface available on Linux, Chrome OS and Android. |
| 27 class UsbDeviceHandleUsbfs : public UsbDeviceHandle { | 27 class UsbDeviceHandleUsbfs : public UsbDeviceHandle { |
| 28 public: | 28 public: |
| 29 // Constructs a new device handle from an existing |device| and open file | 29 // Constructs a new device handle from an existing |device| and open file |
| 30 // descriptor to that device. |blocking_task_runner| must have a | 30 // descriptor to that device. |blocking_task_runner| must run tasks on a |
| 31 // MessageLoopForIO. | 31 // thread that supports FileDescriptorWatcher. |
| 32 UsbDeviceHandleUsbfs( | 32 UsbDeviceHandleUsbfs( |
| 33 scoped_refptr<UsbDevice> device, | 33 scoped_refptr<UsbDevice> device, |
| 34 base::ScopedFD fd, | 34 base::ScopedFD fd, |
| 35 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner); | 35 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner); |
| 36 | 36 |
| 37 // UsbDeviceHandle implementation. | 37 // UsbDeviceHandle implementation. |
| 38 scoped_refptr<UsbDevice> GetDevice() const override; | 38 scoped_refptr<UsbDevice> GetDevice() const override; |
| 39 void Close() override; | 39 void Close() override; |
| 40 void SetConfiguration(int configuration_value, | 40 void SetConfiguration(int configuration_value, |
| 41 const ResultCallback& callback) override; | 41 const ResultCallback& callback) override; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 // thread's message loop is destroyed but can also be freed by this class on | 162 // thread's message loop is destroyed but can also be freed by this class on |
| 163 // destruction. | 163 // destruction. |
| 164 FileThreadHelper* helper_; | 164 FileThreadHelper* helper_; |
| 165 | 165 |
| 166 std::list<std::unique_ptr<Transfer>> transfers_; | 166 std::list<std::unique_ptr<Transfer>> transfers_; |
| 167 }; | 167 }; |
| 168 | 168 |
| 169 } // namespace device | 169 } // namespace device |
| 170 | 170 |
| 171 #endif // DEVICE_USB_USB_DEVICE_HANDLE_USBFS_H_ | 171 #endif // DEVICE_USB_USB_DEVICE_HANDLE_USBFS_H_ |
| OLD | NEW |