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_IMPL_H_ | 5 #ifndef DEVICE_USB_USB_DEVICE_IMPL_H_ |
6 #define DEVICE_USB_USB_DEVICE_IMPL_H_ | 6 #define DEVICE_USB_USB_DEVICE_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <list> | 10 #include <list> |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 PlatformUsbDevice platform_device() const { return platform_device_; } | 64 PlatformUsbDevice platform_device() const { return platform_device_; } |
65 | 65 |
66 protected: | 66 protected: |
67 friend class UsbServiceImpl; | 67 friend class UsbServiceImpl; |
68 friend class UsbDeviceHandleImpl; | 68 friend class UsbDeviceHandleImpl; |
69 | 69 |
70 // Called by UsbServiceImpl only; | 70 // Called by UsbServiceImpl only; |
71 UsbDeviceImpl(scoped_refptr<UsbContext> context, | 71 UsbDeviceImpl(scoped_refptr<UsbContext> context, |
72 PlatformUsbDevice platform_device, | 72 PlatformUsbDevice platform_device, |
73 const libusb_device_descriptor& descriptor, | 73 const libusb_device_descriptor& descriptor); |
74 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner); | |
75 | 74 |
76 ~UsbDeviceImpl() override; | 75 ~UsbDeviceImpl() override; |
77 | 76 |
78 void ReadAllConfigurations(); | 77 void ReadAllConfigurations(); |
79 void RefreshActiveConfiguration(); | 78 void RefreshActiveConfiguration(); |
80 | 79 |
81 // Called only by UsbServiceImpl. | 80 // Called only by UsbServiceImpl. |
82 void set_visited(bool visited) { visited_ = visited; } | 81 void set_visited(bool visited) { visited_ = visited; } |
83 bool was_visited() const { return visited_; } | 82 bool was_visited() const { return visited_; } |
84 | 83 |
85 private: | 84 private: |
86 void GetAllConfigurations(); | 85 void GetAllConfigurations(); |
87 void OpenOnBlockingThread(const OpenCallback& callback); | 86 void OpenOnBlockingThread( |
| 87 const OpenCallback& callback, |
| 88 scoped_refptr<base::TaskRunner> task_runner, |
| 89 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner); |
88 void Opened(PlatformUsbDeviceHandle platform_handle, | 90 void Opened(PlatformUsbDeviceHandle platform_handle, |
89 const OpenCallback& callback); | 91 const OpenCallback& callback, |
| 92 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner); |
90 | 93 |
91 base::ThreadChecker thread_checker_; | 94 base::ThreadChecker thread_checker_; |
92 PlatformUsbDevice platform_device_; | 95 PlatformUsbDevice platform_device_; |
93 bool visited_ = false; | 96 bool visited_ = false; |
94 | 97 |
95 // Retain the context so that it will not be released before UsbDevice. | 98 // Retain the context so that it will not be released before UsbDevice. |
96 scoped_refptr<UsbContext> context_; | 99 scoped_refptr<UsbContext> context_; |
97 | 100 |
98 scoped_refptr<base::SequencedTaskRunner> task_runner_; | |
99 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | |
100 | |
101 DISALLOW_COPY_AND_ASSIGN(UsbDeviceImpl); | 101 DISALLOW_COPY_AND_ASSIGN(UsbDeviceImpl); |
102 }; | 102 }; |
103 | 103 |
104 } // namespace device | 104 } // namespace device |
105 | 105 |
106 #endif // DEVICE_USB_USB_DEVICE_IMPL_H_ | 106 #endif // DEVICE_USB_USB_DEVICE_IMPL_H_ |
OLD | NEW |