| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_device.h" | 5 #include "device/usb/usb_device.h" |
| 6 | 6 |
| 7 #include "base/guid.h" | 7 #include "base/guid.h" |
| 8 #include "device/usb/usb_device_handle.h" | 8 #include "device/usb/usb_device_handle.h" |
| 9 #include "device/usb/webusb_descriptors.h" | 9 #include "device/usb/webusb_descriptors.h" |
| 10 | 10 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 | 74 |
| 75 void UsbDevice::NotifyDeviceRemoved() { | 75 void UsbDevice::NotifyDeviceRemoved() { |
| 76 FOR_EACH_OBSERVER(Observer, observer_list_, OnDeviceRemoved(this)); | 76 FOR_EACH_OBSERVER(Observer, observer_list_, OnDeviceRemoved(this)); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void UsbDevice::OnDisconnect() { | 79 void UsbDevice::OnDisconnect() { |
| 80 // Swap out the handle list as HandleClosed() will try to modify it. | 80 // Swap out the handle list as HandleClosed() will try to modify it. |
| 81 std::list<UsbDeviceHandle*> handles; | 81 std::list<UsbDeviceHandle*> handles; |
| 82 handles.swap(handles_); | 82 handles.swap(handles_); |
| 83 for (auto handle : handles_) | 83 for (auto* handle : handles_) |
| 84 handle->Close(); | 84 handle->Close(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void UsbDevice::HandleClosed(UsbDeviceHandle* handle) { | 87 void UsbDevice::HandleClosed(UsbDeviceHandle* handle) { |
| 88 handles_.remove(handle); | 88 handles_.remove(handle); |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace device | 91 } // namespace device |
| OLD | NEW |