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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 struct Transfer; | 97 struct Transfer; |
98 struct InterfaceInfo { | 98 struct InterfaceInfo { |
99 uint8_t alternate_setting; | 99 uint8_t alternate_setting; |
100 }; | 100 }; |
101 struct EndpointInfo { | 101 struct EndpointInfo { |
102 UsbTransferType type; | 102 UsbTransferType type; |
103 const UsbInterfaceDescriptor* interface; | 103 const UsbInterfaceDescriptor* interface; |
104 }; | 104 }; |
105 | 105 |
106 virtual void CloseBlocking(); | 106 virtual void CloseBlocking(); |
107 void SetConfigurationBlocking(int configuration_value, | |
108 const ResultCallback& callback); | |
109 void SetConfigurationComplete(int configuration_value, | 107 void SetConfigurationComplete(int configuration_value, |
110 bool success, | 108 bool success, |
111 const ResultCallback& callback); | 109 const ResultCallback& callback); |
112 void ReleaseInterfaceBlocking(int interface_number, | |
113 const ResultCallback& callback); | |
114 void ReleaseInterfaceComplete(int interface_number, | 110 void ReleaseInterfaceComplete(int interface_number, |
115 const ResultCallback& callback); | 111 const ResultCallback& callback); |
116 void SetInterfaceBlocking(int interface_number, | |
117 int alternate_setting, | |
118 const ResultCallback& callback); | |
119 void ResetDeviceBlocking(const ResultCallback& callback); | |
120 void ClearHaltBlocking(uint8_t endpoint_address, | |
121 const ResultCallback& callback); | |
122 void IsochronousTransferInternal(uint8_t endpoint_address, | 112 void IsochronousTransferInternal(uint8_t endpoint_address, |
123 scoped_refptr<net::IOBuffer> buffer, | 113 scoped_refptr<net::IOBuffer> buffer, |
124 size_t total_length, | 114 size_t total_length, |
125 const std::vector<uint32_t>& packet_lengths, | 115 const std::vector<uint32_t>& packet_lengths, |
126 unsigned int timeout, | 116 unsigned int timeout, |
127 const IsochronousTransferCallback& callback); | 117 const IsochronousTransferCallback& callback); |
128 void GenericTransferInternal( | 118 void GenericTransferInternal( |
129 UsbEndpointDirection direction, | 119 UsbEndpointDirection direction, |
130 uint8_t endpoint_number, | 120 uint8_t endpoint_number, |
131 scoped_refptr<net::IOBuffer> buffer, | 121 scoped_refptr<net::IOBuffer> buffer, |
(...skipping 21 matching lines...) Expand all Loading... |
153 | 143 |
154 // Maps claimed interfaces by interface number to their current alternate | 144 // Maps claimed interfaces by interface number to their current alternate |
155 // setting. | 145 // setting. |
156 std::map<uint8_t, InterfaceInfo> interfaces_; | 146 std::map<uint8_t, InterfaceInfo> interfaces_; |
157 | 147 |
158 // Maps endpoints (by endpoint address) to the interface they are a part of. | 148 // Maps endpoints (by endpoint address) to the interface they are a part of. |
159 // Only endpoints of currently claimed and selected interface alternates are | 149 // Only endpoints of currently claimed and selected interface alternates are |
160 // included in the map. | 150 // included in the map. |
161 std::map<uint8_t, EndpointInfo> endpoints_; | 151 std::map<uint8_t, EndpointInfo> endpoints_; |
162 | 152 |
163 // Helper object owned by the blocking task thread. It will be freed if that | 153 // Helper object exists on the blocking task thread and must be freed there. |
164 // thread's message loop is destroyed but can also be freed by this class on | 154 std::unique_ptr<FileThreadHelper> helper_; |
165 // destruction. | |
166 FileThreadHelper* helper_; | |
167 | 155 |
168 std::list<std::unique_ptr<Transfer>> transfers_; | 156 std::list<std::unique_ptr<Transfer>> transfers_; |
169 }; | 157 }; |
170 | 158 |
171 } // namespace device | 159 } // namespace device |
172 | 160 |
173 #endif // DEVICE_USB_USB_DEVICE_HANDLE_USBFS_H_ | 161 #endif // DEVICE_USB_USB_DEVICE_HANDLE_USBFS_H_ |
OLD | NEW |