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 #ifndef DEVICE_USB_USB_DEVICE_HANDLE_IMPL_H_ | 5 #ifndef DEVICE_USB_USB_DEVICE_HANDLE_IMPL_H_ |
6 #define DEVICE_USB_USB_DEVICE_HANDLE_IMPL_H_ | 6 #define DEVICE_USB_USB_DEVICE_HANDLE_IMPL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <map> | 11 #include <map> |
| 12 #include <memory> |
12 #include <set> | 13 #include <set> |
13 #include <vector> | 14 #include <vector> |
14 | 15 |
15 #include "base/callback.h" | 16 #include "base/callback.h" |
16 #include "base/macros.h" | 17 #include "base/macros.h" |
17 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
18 #include "base/threading/thread_checker.h" | 19 #include "base/threading/thread_checker.h" |
19 #include "device/usb/usb_device_handle.h" | 20 #include "device/usb/usb_device_handle.h" |
20 #include "third_party/libusb/src/libusb/libusb.h" | 21 #include "third_party/libusb/src/libusb/libusb.h" |
21 | 22 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 uint8_t endpoint_address, | 173 uint8_t endpoint_address, |
173 scoped_refptr<net::IOBuffer> buffer, | 174 scoped_refptr<net::IOBuffer> buffer, |
174 size_t length, | 175 size_t length, |
175 unsigned int timeout, | 176 unsigned int timeout, |
176 scoped_refptr<base::TaskRunner> callback_task_runner, | 177 scoped_refptr<base::TaskRunner> callback_task_runner, |
177 const TransferCallback& callback); | 178 const TransferCallback& callback); |
178 | 179 |
179 // Submits a transfer and starts tracking it. Retains the buffer and copies | 180 // Submits a transfer and starts tracking it. Retains the buffer and copies |
180 // the completion callback until the transfer finishes, whereupon it invokes | 181 // the completion callback until the transfer finishes, whereupon it invokes |
181 // the callback then releases the buffer. | 182 // the callback then releases the buffer. |
182 void SubmitTransfer(scoped_ptr<Transfer> transfer); | 183 void SubmitTransfer(std::unique_ptr<Transfer> transfer); |
183 | 184 |
184 // Removes the transfer from the in-flight transfer set and invokes the | 185 // Removes the transfer from the in-flight transfer set and invokes the |
185 // completion callback. | 186 // completion callback. |
186 void TransferComplete(Transfer* transfer, const base::Closure& callback); | 187 void TransferComplete(Transfer* transfer, const base::Closure& callback); |
187 | 188 |
188 scoped_refptr<UsbDeviceImpl> device_; | 189 scoped_refptr<UsbDeviceImpl> device_; |
189 | 190 |
190 PlatformUsbDeviceHandle handle_; | 191 PlatformUsbDeviceHandle handle_; |
191 | 192 |
192 typedef std::map<int, scoped_refptr<InterfaceClaimer>> ClaimedInterfaceMap; | 193 typedef std::map<int, scoped_refptr<InterfaceClaimer>> ClaimedInterfaceMap; |
(...skipping 14 matching lines...) Expand all Loading... |
207 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 208 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
208 | 209 |
209 base::ThreadChecker thread_checker_; | 210 base::ThreadChecker thread_checker_; |
210 | 211 |
211 DISALLOW_COPY_AND_ASSIGN(UsbDeviceHandleImpl); | 212 DISALLOW_COPY_AND_ASSIGN(UsbDeviceHandleImpl); |
212 }; | 213 }; |
213 | 214 |
214 } // namespace device | 215 } // namespace device |
215 | 216 |
216 #endif // DEVICE_USB_USB_DEVICE_HANDLE_IMPL_H_ | 217 #endif // DEVICE_USB_USB_DEVICE_HANDLE_IMPL_H_ |
OLD | NEW |