| 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_device_impl.h" | 5 #include "device/usb/usb_device_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 for (HandlesVector::iterator it = handles_.begin(); it != handles_.end(); | 201 for (HandlesVector::iterator it = handles_.begin(); it != handles_.end(); |
| 202 ++it) { | 202 ++it) { |
| 203 if (it->get() == handle.get()) { | 203 if (it->get() == handle.get()) { |
| 204 (*it)->InternalClose(); | 204 (*it)->InternalClose(); |
| 205 handles_.erase(it); | 205 handles_.erase(it); |
| 206 return; | 206 return; |
| 207 } | 207 } |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 | 210 |
| 211 const UsbConfigDescriptor* UsbDeviceImpl::GetActiveConfiguration() { | 211 const UsbConfigDescriptor* UsbDeviceImpl::GetActiveConfiguration() const { |
| 212 DCHECK(thread_checker_.CalledOnValidThread()); | 212 DCHECK(thread_checker_.CalledOnValidThread()); |
| 213 return active_configuration_; | 213 return active_configuration_; |
| 214 } | 214 } |
| 215 | 215 |
| 216 void UsbDeviceImpl::OnDisconnect() { | 216 void UsbDeviceImpl::OnDisconnect() { |
| 217 DCHECK(thread_checker_.CalledOnValidThread()); | 217 DCHECK(thread_checker_.CalledOnValidThread()); |
| 218 | 218 |
| 219 // Swap the list of handles into a local variable because closing all open | 219 // Swap the list of handles into a local variable because closing all open |
| 220 // handles may release the last reference to this object. | 220 // handles may release the last reference to this object. |
| 221 HandlesVector handles; | 221 HandlesVector handles; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 void UsbDeviceImpl::Opened(PlatformUsbDeviceHandle platform_handle, | 329 void UsbDeviceImpl::Opened(PlatformUsbDeviceHandle platform_handle, |
| 330 const OpenCallback& callback) { | 330 const OpenCallback& callback) { |
| 331 DCHECK(thread_checker_.CalledOnValidThread()); | 331 DCHECK(thread_checker_.CalledOnValidThread()); |
| 332 scoped_refptr<UsbDeviceHandleImpl> device_handle = new UsbDeviceHandleImpl( | 332 scoped_refptr<UsbDeviceHandleImpl> device_handle = new UsbDeviceHandleImpl( |
| 333 context_, this, platform_handle, blocking_task_runner_); | 333 context_, this, platform_handle, blocking_task_runner_); |
| 334 handles_.push_back(device_handle); | 334 handles_.push_back(device_handle); |
| 335 callback.Run(device_handle); | 335 callback.Run(device_handle); |
| 336 } | 336 } |
| 337 | 337 |
| 338 } // namespace device | 338 } // namespace device |
| OLD | NEW |