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

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

Issue 1784733002: Track USB device configuration state in Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blink_open_state
Patch Set: Rebased. Created 4 years, 9 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
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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « device/usb/usb_device_impl.h ('k') | third_party/WebKit/LayoutTests/usb/resources/fake-devices.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698