| 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 "chrome/browser/devtools/device/usb/android_usb_device.h" | 5 #include "chrome/browser/devtools/device/usb/android_usb_device.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/barrier_closure.h" | 9 #include "base/barrier_closure.h" |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 void AndroidUsbDevice::TransferError(UsbTransferStatus status) { | 614 void AndroidUsbDevice::TransferError(UsbTransferStatus status) { |
| 615 DCHECK(message_loop_ == base::MessageLoop::current()); | 615 DCHECK(message_loop_ == base::MessageLoop::current()); |
| 616 | 616 |
| 617 message_loop_->PostTask(FROM_HERE, | 617 message_loop_->PostTask(FROM_HERE, |
| 618 base::Bind(&AndroidUsbDevice::Terminate, this)); | 618 base::Bind(&AndroidUsbDevice::Terminate, this)); |
| 619 } | 619 } |
| 620 | 620 |
| 621 void AndroidUsbDevice::TerminateIfReleased( | 621 void AndroidUsbDevice::TerminateIfReleased( |
| 622 scoped_refptr<UsbDeviceHandle> usb_handle) { | 622 scoped_refptr<UsbDeviceHandle> usb_handle) { |
| 623 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 623 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 624 if (usb_handle->GetDevice()) | 624 if (usb_handle->GetDevice().get()) |
| 625 return; | 625 return; |
| 626 message_loop_->PostTask(FROM_HERE, | 626 message_loop_->PostTask(FROM_HERE, |
| 627 base::Bind(&AndroidUsbDevice::Terminate, this)); | 627 base::Bind(&AndroidUsbDevice::Terminate, this)); |
| 628 } | 628 } |
| 629 | 629 |
| 630 void AndroidUsbDevice::Terminate() { | 630 void AndroidUsbDevice::Terminate() { |
| 631 DCHECK(message_loop_ == base::MessageLoop::current()); | 631 DCHECK(message_loop_ == base::MessageLoop::current()); |
| 632 | 632 |
| 633 std::vector<AndroidUsbDevice*>::iterator it = | 633 std::vector<AndroidUsbDevice*>::iterator it = |
| 634 std::find(g_devices.Get().begin(), g_devices.Get().end(), this); | 634 std::find(g_devices.Get().begin(), g_devices.Get().end(), this); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 654 BrowserThread::PostTask( | 654 BrowserThread::PostTask( |
| 655 BrowserThread::FILE, FROM_HERE, | 655 BrowserThread::FILE, FROM_HERE, |
| 656 base::Bind(&ReleaseInterface, usb_handle, interface_id_)); | 656 base::Bind(&ReleaseInterface, usb_handle, interface_id_)); |
| 657 } | 657 } |
| 658 | 658 |
| 659 void AndroidUsbDevice::SocketDeleted(uint32 socket_id) { | 659 void AndroidUsbDevice::SocketDeleted(uint32 socket_id) { |
| 660 DCHECK(message_loop_ == base::MessageLoop::current()); | 660 DCHECK(message_loop_ == base::MessageLoop::current()); |
| 661 | 661 |
| 662 sockets_.erase(socket_id); | 662 sockets_.erase(socket_id); |
| 663 } | 663 } |
| OLD | NEW |