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 <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/files/scoped_file.h" | 13 #include "base/files/scoped_file.h" |
13 #include "base/memory/scoped_ptr.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 } | 20 } |
21 | 21 |
22 namespace device { | 22 namespace device { |
23 | 23 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 void ResetDeviceBlocking(const ResultCallback& callback); | 106 void ResetDeviceBlocking(const ResultCallback& callback); |
107 void ClearHaltBlocking(uint8_t endpoint_address, | 107 void ClearHaltBlocking(uint8_t endpoint_address, |
108 const ResultCallback& callback); | 108 const ResultCallback& callback); |
109 void IsochronousTransferInternal(uint8_t endpoint_address, | 109 void IsochronousTransferInternal(uint8_t endpoint_address, |
110 scoped_refptr<net::IOBuffer> buffer, | 110 scoped_refptr<net::IOBuffer> buffer, |
111 size_t total_length, | 111 size_t total_length, |
112 const std::vector<uint32_t>& packet_lengths, | 112 const std::vector<uint32_t>& packet_lengths, |
113 unsigned int timeout, | 113 unsigned int timeout, |
114 const IsochronousTransferCallback& callback); | 114 const IsochronousTransferCallback& callback); |
115 void ReapedUrbs(const std::vector<usbdevfs_urb*>& urbs); | 115 void ReapedUrbs(const std::vector<usbdevfs_urb*>& urbs); |
116 void TransferComplete(scoped_ptr<Transfer> transfer); | 116 void TransferComplete(std::unique_ptr<Transfer> transfer); |
117 void RefreshEndpointInfo(); | 117 void RefreshEndpointInfo(); |
118 void ReportIsochronousError( | 118 void ReportIsochronousError( |
119 const std::vector<uint32_t>& packet_lengths, | 119 const std::vector<uint32_t>& packet_lengths, |
120 const UsbDeviceHandle::IsochronousTransferCallback& callback, | 120 const UsbDeviceHandle::IsochronousTransferCallback& callback, |
121 UsbTransferStatus status); | 121 UsbTransferStatus status); |
122 void SetUpTimeoutCallback(Transfer* transfer, unsigned int timeout); | 122 void SetUpTimeoutCallback(Transfer* transfer, unsigned int timeout); |
123 | 123 |
124 static void CancelTransfer(Transfer* transfer, UsbTransferStatus status); | 124 static void CancelTransfer(Transfer* transfer, UsbTransferStatus status); |
125 | 125 |
126 scoped_refptr<UsbDevice> device_; | 126 scoped_refptr<UsbDevice> device_; |
127 base::ScopedFD fd_; | 127 base::ScopedFD fd_; |
128 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 128 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
129 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 129 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
130 base::ThreadChecker thread_checker_; | 130 base::ThreadChecker thread_checker_; |
131 | 131 |
132 // Maps claimed interfaces by interface number to their current alternate | 132 // Maps claimed interfaces by interface number to their current alternate |
133 // setting. | 133 // setting. |
134 std::map<uint8_t, InterfaceInfo> interfaces_; | 134 std::map<uint8_t, InterfaceInfo> interfaces_; |
135 | 135 |
136 // Maps endpoints (by endpoint address) to the interface they are a part of. | 136 // Maps endpoints (by endpoint address) to the interface they are a part of. |
137 // Only endpoints of currently claimed and selected interface alternates are | 137 // Only endpoints of currently claimed and selected interface alternates are |
138 // included in the map. | 138 // included in the map. |
139 std::map<uint8_t, EndpointInfo> endpoints_; | 139 std::map<uint8_t, EndpointInfo> endpoints_; |
140 | 140 |
141 // Helper object owned by the blocking task thread. It will be freed if that | 141 // Helper object owned by the blocking task thread. It will be freed if that |
142 // thread's message loop is destroyed but can also be freed by this class on | 142 // thread's message loop is destroyed but can also be freed by this class on |
143 // destruction. | 143 // destruction. |
144 FileThreadHelper* helper_; | 144 FileThreadHelper* helper_; |
145 | 145 |
146 std::list<scoped_ptr<Transfer>> transfers_; | 146 std::list<std::unique_ptr<Transfer>> transfers_; |
147 }; | 147 }; |
148 | 148 |
149 } // namespace device | 149 } // namespace device |
150 | 150 |
151 #endif // DEVICE_USB_USB_DEVICE_HANDLE_USBFS_H_ | 151 #endif // DEVICE_USB_USB_DEVICE_HANDLE_USBFS_H_ |
OLD | NEW |