| 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> |
| 11 #include <unordered_set> | 11 #include <unordered_set> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/bind_helpers.h" | 14 #include "base/bind_helpers.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
| 18 #include "base/sequenced_task_runner.h" |
| 19 #include "base/single_thread_task_runner.h" |
| 18 #include "base/threading/non_thread_safe.h" | 20 #include "base/threading/non_thread_safe.h" |
| 19 | 21 |
| 20 namespace base { | |
| 21 class SequencedTaskRunner; | |
| 22 } | |
| 23 | |
| 24 namespace device { | 22 namespace device { |
| 25 | 23 |
| 26 class UsbDevice; | 24 class UsbDevice; |
| 27 | 25 |
| 28 // The USB service handles creating and managing an event handler thread that is | 26 // The USB service handles creating and managing an event handler thread that is |
| 29 // used to manage and dispatch USB events. It is also responsible for device | 27 // used to manage and dispatch USB events. It is also responsible for device |
| 30 // discovery on the system, which allows it to re-use device handles to prevent | 28 // discovery on the system, which allows it to re-use device handles to prevent |
| 31 // competition for the same USB device. | 29 // competition for the same USB device. |
| 32 class UsbService : public base::NonThreadSafe { | 30 class UsbService : public base::NonThreadSafe { |
| 33 public: | 31 public: |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 std::unordered_map<std::string, scoped_refptr<UsbDevice>> devices_; | 96 std::unordered_map<std::string, scoped_refptr<UsbDevice>> devices_; |
| 99 std::unordered_set<std::string> testing_devices_; | 97 std::unordered_set<std::string> testing_devices_; |
| 100 base::ObserverList<Observer, true> observer_list_; | 98 base::ObserverList<Observer, true> observer_list_; |
| 101 | 99 |
| 102 DISALLOW_COPY_AND_ASSIGN(UsbService); | 100 DISALLOW_COPY_AND_ASSIGN(UsbService); |
| 103 }; | 101 }; |
| 104 | 102 |
| 105 } // namespace device | 103 } // namespace device |
| 106 | 104 |
| 107 #endif // DEVICE_USB_USB_SERVICE_H_ | 105 #endif // DEVICE_USB_USB_SERVICE_H_ |
| OLD | NEW |