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 #include "device/usb/usb_service_impl.h" | 5 #include "device/usb/usb_service_impl.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/barrier_closure.h" | 10 #include "base/barrier_closure.h" |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 RefreshDevices(); | 555 RefreshDevices(); |
556 #if defined(OS_WIN) | 556 #if defined(OS_WIN) |
557 DeviceMonitorWin* device_monitor = DeviceMonitorWin::GetForAllInterfaces(); | 557 DeviceMonitorWin* device_monitor = DeviceMonitorWin::GetForAllInterfaces(); |
558 if (device_monitor) { | 558 if (device_monitor) { |
559 device_observer_.Add(device_monitor); | 559 device_observer_.Add(device_monitor); |
560 } | 560 } |
561 #endif // OS_WIN | 561 #endif // OS_WIN |
562 } | 562 } |
563 | 563 |
564 UsbServiceImpl::~UsbServiceImpl() { | 564 UsbServiceImpl::~UsbServiceImpl() { |
565 | |
566 if (hotplug_enabled_) { | 565 if (hotplug_enabled_) { |
567 libusb_hotplug_deregister_callback(context_->context(), hotplug_handle_); | 566 libusb_hotplug_deregister_callback(context_->context(), hotplug_handle_); |
568 } | 567 } |
569 for (const auto& map_entry : devices_) { | 568 for (const auto& map_entry : devices_) { |
570 map_entry.second->OnDisconnect(); | 569 map_entry.second->OnDisconnect(); |
571 } | 570 } |
572 } | 571 } |
573 | 572 |
574 scoped_refptr<UsbDevice> UsbServiceImpl::GetDevice(const std::string& guid) { | 573 scoped_refptr<UsbDevice> UsbServiceImpl::GetDevice(const std::string& guid) { |
575 DCHECK(CalledOnValidThread()); | 574 DCHECK(CalledOnValidThread()); |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 PlatformDeviceMap::iterator it = platform_devices_.find(platform_device); | 853 PlatformDeviceMap::iterator it = platform_devices_.find(platform_device); |
855 if (it != platform_devices_.end()) { | 854 if (it != platform_devices_.end()) { |
856 RemoveDevice(it->second); | 855 RemoveDevice(it->second); |
857 } else { | 856 } else { |
858 devices_being_enumerated_.erase(platform_device); | 857 devices_being_enumerated_.erase(platform_device); |
859 } | 858 } |
860 libusb_unref_device(platform_device); | 859 libusb_unref_device(platform_device); |
861 } | 860 } |
862 | 861 |
863 } // namespace device | 862 } // namespace device |
OLD | NEW |