OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "config.h" | |
6 #include "modules/webusb/USBInterface.h" | |
7 | |
8 #include "modules/webusb/USBAlternateInterface.h" | |
9 #include "modules/webusb/USBConfiguration.h" | |
10 | |
11 namespace blink { | |
12 | |
13 // static | |
14 USBInterface* USBInterface::create(const USBConfiguration* configuration, size_t interfaceIndex) | |
15 { | |
16 return new USBInterface(configuration, interfaceIndex); | |
17 } | |
18 | |
19 USBInterface::USBInterface(const USBConfiguration* configuration, size_t interfa ceIndex) | |
20 : m_configuration(configuration) | |
21 , m_interfaceIndex(interfaceIndex) | |
22 { | |
23 } | |
24 | |
25 const WebUSBDeviceInfo::Interface& USBInterface::info() const | |
26 { | |
27 const WebUSBDeviceInfo::Configuration& configInfo = m_configuration->info(); | |
28 ASSERT(m_interfaceIndex < configInfo.interfaces.size()); | |
29 return configInfo.interfaces[m_interfaceIndex]; | |
30 } | |
31 | |
32 uint8_t USBInterface::interfaceNumber() const | |
33 { | |
34 return info().interfaceNumber; | |
35 } | |
36 | |
37 HeapVector<Member<USBAlternateInterface>> USBInterface::alternates() const | |
38 { | |
39 HeapVector<Member<USBAlternateInterface>> alternates; | |
40 for (size_t i = 0; i < info().alternates.size(); ++i) | |
41 alternates.append(USBAlternateInterface::create(this, i)); | |
42 return alternates; | |
43 } | |
44 | |
45 DEFINE_TRACE(USBInterface) | |
46 { | |
47 visitor->trace(m_configuration); | |
Reilly Grant (use Gerrit)
2015/07/28 22:51:43
#ifdef ENABLE(OILPAN)?
| |
48 } | |
49 | |
50 } // namespace blink | |
OLD | NEW |