| 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_handle_impl.h" | 5 #include "device/usb/usb_device_handle_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 } | 472 } |
| 473 | 473 |
| 474 UsbDeviceHandleImpl::UsbDeviceHandleImpl(scoped_refptr<UsbContext> context, | 474 UsbDeviceHandleImpl::UsbDeviceHandleImpl(scoped_refptr<UsbContext> context, |
| 475 UsbDeviceImpl* device, | 475 UsbDeviceImpl* device, |
| 476 PlatformUsbDeviceHandle handle, | 476 PlatformUsbDeviceHandle handle, |
| 477 const UsbConfigDescriptor& config) | 477 const UsbConfigDescriptor& config) |
| 478 : device_(device), | 478 : device_(device), |
| 479 handle_(handle), | 479 handle_(handle), |
| 480 config_(config), | 480 config_(config), |
| 481 context_(context), | 481 context_(context), |
| 482 weak_factory_(this), | 482 task_runner_(base::ThreadTaskRunnerHandle::Get()), |
| 483 task_runner_(base::ThreadTaskRunnerHandle::Get()) { | 483 weak_factory_(this) { |
| 484 DCHECK(handle) << "Cannot create device with NULL handle."; | 484 DCHECK(handle) << "Cannot create device with NULL handle."; |
| 485 } | 485 } |
| 486 | 486 |
| 487 UsbDeviceHandleImpl::~UsbDeviceHandleImpl() { | 487 UsbDeviceHandleImpl::~UsbDeviceHandleImpl() { |
| 488 DCHECK(thread_checker_.CalledOnValidThread()); | 488 DCHECK(thread_checker_.CalledOnValidThread()); |
| 489 | 489 |
| 490 libusb_close(handle_); | 490 libusb_close(handle_); |
| 491 handle_ = NULL; | 491 handle_ = NULL; |
| 492 } | 492 } |
| 493 | 493 |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 // Attempt-release all the interfaces. | 833 // Attempt-release all the interfaces. |
| 834 // It will be retained until the transfer cancellation is finished. | 834 // It will be retained until the transfer cancellation is finished. |
| 835 claimed_interfaces_.clear(); | 835 claimed_interfaces_.clear(); |
| 836 | 836 |
| 837 // Cannot close device handle here. Need to wait for libusb_cancel_transfer to | 837 // Cannot close device handle here. Need to wait for libusb_cancel_transfer to |
| 838 // finish. | 838 // finish. |
| 839 device_ = NULL; | 839 device_ = NULL; |
| 840 } | 840 } |
| 841 | 841 |
| 842 } // namespace device | 842 } // namespace device |
| OLD | NEW |