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> |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 const TransferCallback& callback, | 127 const TransferCallback& callback, |
128 scoped_refptr<base::SingleThreadTaskRunner> callback_runner); | 128 scoped_refptr<base::SingleThreadTaskRunner> callback_runner); |
129 void ReapedUrbs(const std::vector<usbdevfs_urb*>& urbs); | 129 void ReapedUrbs(const std::vector<usbdevfs_urb*>& urbs); |
130 void TransferComplete(std::unique_ptr<Transfer> transfer); | 130 void TransferComplete(std::unique_ptr<Transfer> transfer); |
131 void RefreshEndpointInfo(); | 131 void RefreshEndpointInfo(); |
132 void ReportIsochronousError( | 132 void ReportIsochronousError( |
133 const std::vector<uint32_t>& packet_lengths, | 133 const std::vector<uint32_t>& packet_lengths, |
134 const UsbDeviceHandle::IsochronousTransferCallback& callback, | 134 const UsbDeviceHandle::IsochronousTransferCallback& callback, |
135 UsbTransferStatus status); | 135 UsbTransferStatus status); |
136 void SetUpTimeoutCallback(Transfer* transfer, unsigned int timeout); | 136 void SetUpTimeoutCallback(Transfer* transfer, unsigned int timeout); |
| 137 void OnTimeout(Transfer* transfer); |
137 std::unique_ptr<Transfer> RemoveFromTransferList(Transfer* transfer); | 138 std::unique_ptr<Transfer> RemoveFromTransferList(Transfer* transfer); |
138 void CancelTransfer(Transfer* transfer, UsbTransferStatus status); | 139 void CancelTransfer(Transfer* transfer, UsbTransferStatus status); |
139 void DiscardUrbBlocking(Transfer* transfer); | 140 void DiscardUrbBlocking(Transfer* transfer); |
140 void UrbDiscarded(Transfer* transfer); | 141 void UrbDiscarded(Transfer* transfer); |
141 | 142 |
142 scoped_refptr<UsbDevice> device_; | 143 scoped_refptr<UsbDevice> device_; |
143 int fd_; // Copy of the base::ScopedFD held by |helper_| valid if |device_|. | 144 int fd_; // Copy of the base::ScopedFD held by |helper_| valid if |device_|. |
144 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 145 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
145 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 146 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
146 | 147 |
147 // Maps claimed interfaces by interface number to their current alternate | 148 // Maps claimed interfaces by interface number to their current alternate |
148 // setting. | 149 // setting. |
149 std::map<uint8_t, InterfaceInfo> interfaces_; | 150 std::map<uint8_t, InterfaceInfo> interfaces_; |
150 | 151 |
151 // Maps endpoints (by endpoint address) to the interface they are a part of. | 152 // Maps endpoints (by endpoint address) to the interface they are a part of. |
152 // Only endpoints of currently claimed and selected interface alternates are | 153 // Only endpoints of currently claimed and selected interface alternates are |
153 // included in the map. | 154 // included in the map. |
154 std::map<uint8_t, EndpointInfo> endpoints_; | 155 std::map<uint8_t, EndpointInfo> endpoints_; |
155 | 156 |
156 // Helper object exists on the blocking task thread and all calls to it and | 157 // Helper object exists on the blocking task thread and all calls to it and |
157 // its destruction must be posted there. | 158 // its destruction must be posted there. |
158 std::unique_ptr<FileThreadHelper> helper_; | 159 std::unique_ptr<FileThreadHelper> helper_; |
159 | 160 |
160 std::list<std::unique_ptr<Transfer>> transfers_; | 161 std::list<std::unique_ptr<Transfer>> transfers_; |
| 162 base::SequenceChecker sequence_checker_; |
161 }; | 163 }; |
162 | 164 |
163 } // namespace device | 165 } // namespace device |
164 | 166 |
165 #endif // DEVICE_USB_USB_DEVICE_HANDLE_USBFS_H_ | 167 #endif // DEVICE_USB_USB_DEVICE_HANDLE_USBFS_H_ |
OLD | NEW |