Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: device/usb/usb_device_impl.cc

Issue 1565313002: Reland of Implement basic USB device enumeration on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dependency fix added to reland. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « device/usb/usb_device_impl.h ('k') | device/usb/usb_endpoint_android.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 client->OpenPath( 197 client->OpenPath(
198 device_path_, 198 device_path_,
199 base::Bind(&UsbDeviceImpl::OnOpenRequestComplete, this, callback)); 199 base::Bind(&UsbDeviceImpl::OnOpenRequestComplete, this, callback));
200 #else 200 #else
201 blocking_task_runner_->PostTask( 201 blocking_task_runner_->PostTask(
202 FROM_HERE, 202 FROM_HERE,
203 base::Bind(&UsbDeviceImpl::OpenOnBlockingThread, this, callback)); 203 base::Bind(&UsbDeviceImpl::OpenOnBlockingThread, this, callback));
204 #endif // defined(OS_CHROMEOS) 204 #endif // defined(OS_CHROMEOS)
205 } 205 }
206 206
207 bool UsbDeviceImpl::Close(scoped_refptr<UsbDeviceHandle> handle) { 207 void UsbDeviceImpl::Close(scoped_refptr<UsbDeviceHandle> handle) {
208 DCHECK(thread_checker_.CalledOnValidThread()); 208 DCHECK(thread_checker_.CalledOnValidThread());
209 209
210 for (HandlesVector::iterator it = handles_.begin(); it != handles_.end(); 210 for (HandlesVector::iterator it = handles_.begin(); it != handles_.end();
211 ++it) { 211 ++it) {
212 if (it->get() == handle.get()) { 212 if (it->get() == handle.get()) {
213 (*it)->InternalClose(); 213 (*it)->InternalClose();
214 handles_.erase(it); 214 handles_.erase(it);
215 return true; 215 return;
216 } 216 }
217 } 217 }
218 return false;
219 } 218 }
220 219
221 const UsbConfigDescriptor* UsbDeviceImpl::GetActiveConfiguration() { 220 const UsbConfigDescriptor* UsbDeviceImpl::GetActiveConfiguration() {
222 DCHECK(thread_checker_.CalledOnValidThread()); 221 DCHECK(thread_checker_.CalledOnValidThread());
223 return active_configuration_; 222 return active_configuration_;
224 } 223 }
225 224
226 void UsbDeviceImpl::OnDisconnect() { 225 void UsbDeviceImpl::OnDisconnect() {
227 DCHECK(thread_checker_.CalledOnValidThread()); 226 DCHECK(thread_checker_.CalledOnValidThread());
228 227
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 void UsbDeviceImpl::Opened(PlatformUsbDeviceHandle platform_handle, 330 void UsbDeviceImpl::Opened(PlatformUsbDeviceHandle platform_handle,
332 const OpenCallback& callback) { 331 const OpenCallback& callback) {
333 DCHECK(thread_checker_.CalledOnValidThread()); 332 DCHECK(thread_checker_.CalledOnValidThread());
334 scoped_refptr<UsbDeviceHandleImpl> device_handle = new UsbDeviceHandleImpl( 333 scoped_refptr<UsbDeviceHandleImpl> device_handle = new UsbDeviceHandleImpl(
335 context_, this, platform_handle, blocking_task_runner_); 334 context_, this, platform_handle, blocking_task_runner_);
336 handles_.push_back(device_handle); 335 handles_.push_back(device_handle);
337 callback.Run(device_handle); 336 callback.Run(device_handle);
338 } 337 }
339 338
340 } // namespace device 339 } // namespace device
OLDNEW
« no previous file with comments | « device/usb/usb_device_impl.h ('k') | device/usb/usb_endpoint_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698