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_SERVICE_H_ | 5 #ifndef DEVICE_USB_USB_SERVICE_H_ |
6 #define DEVICE_USB_USB_SERVICE_H_ | 6 #define DEVICE_USB_USB_SERVICE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <unordered_map> | 10 #include <unordered_map> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 // Notifies the observer that the UsbService it depends on is shutting down. | 48 // Notifies the observer that the UsbService it depends on is shutting down. |
49 virtual void WillDestroyUsbService(); | 49 virtual void WillDestroyUsbService(); |
50 }; | 50 }; |
51 | 51 |
52 // The file task runner reference is used for blocking I/O operations. | 52 // The file task runner reference is used for blocking I/O operations. |
53 // Returns nullptr when initialization fails. | 53 // Returns nullptr when initialization fails. |
54 static std::unique_ptr<UsbService> Create( | 54 static std::unique_ptr<UsbService> Create( |
55 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner); | 55 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner); |
56 | 56 |
| 57 // Creates a SequencedTaskRunner appropriate for blocking I/O operations. |
| 58 static scoped_refptr<base::SequencedTaskRunner> CreateBlockingTaskRunner(); |
| 59 |
57 virtual ~UsbService(); | 60 virtual ~UsbService(); |
58 | 61 |
59 scoped_refptr<UsbDevice> GetDevice(const std::string& guid); | 62 scoped_refptr<UsbDevice> GetDevice(const std::string& guid); |
60 | 63 |
61 // Shuts down the UsbService. Must be called before destroying the UsbService | 64 // Shuts down the UsbService. Must be called before destroying the UsbService |
62 // when tasks can still be posted to the |blocking_task_runner| provided to | 65 // when tasks can still be posted to the |blocking_task_runner| provided to |
63 // Create(). | 66 // Create(). |
64 virtual void Shutdown(); | 67 virtual void Shutdown(); |
65 | 68 |
66 // Enumerates available devices. | 69 // Enumerates available devices. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 #if DCHECK_IS_ON() | 106 #if DCHECK_IS_ON() |
104 bool did_shutdown_ = false; | 107 bool did_shutdown_ = false; |
105 #endif | 108 #endif |
106 | 109 |
107 DISALLOW_COPY_AND_ASSIGN(UsbService); | 110 DISALLOW_COPY_AND_ASSIGN(UsbService); |
108 }; | 111 }; |
109 | 112 |
110 } // namespace device | 113 } // namespace device |
111 | 114 |
112 #endif // DEVICE_USB_USB_SERVICE_H_ | 115 #endif // DEVICE_USB_USB_SERVICE_H_ |
OLD | NEW |