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

Side by Side Diff: third_party/WebKit/Source/modules/webusb/USBDevice.h

Issue 1902263004: Mojo: Change the blink variant from "wtf" to "blink". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 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 2015 The Chromium Authors. All rights reserved. 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 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 #ifndef USBDevice_h 5 #ifndef USBDevice_h
6 #define USBDevice_h 6 #define USBDevice_h
7 7
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptWrappable.h" 9 #include "bindings/core/v8/ScriptWrappable.h"
10 #include "bindings/modules/v8/UnionTypesModules.h" 10 #include "bindings/modules/v8/UnionTypesModules.h"
11 #include "core/dom/ContextLifecycleObserver.h" 11 #include "core/dom/ContextLifecycleObserver.h"
12 #include "device/usb/public/interfaces/device.mojom-wtf.h" 12 #include "device/usb/public/interfaces/device.mojom-blink.h"
13 #include "platform/heap/Handle.h" 13 #include "platform/heap/Handle.h"
14 #include "wtf/BitVector.h" 14 #include "wtf/BitVector.h"
15 #include "wtf/Vector.h" 15 #include "wtf/Vector.h"
16 16
17 namespace blink { 17 namespace blink {
18 18
19 class ScriptPromiseResolver; 19 class ScriptPromiseResolver;
20 class ScriptState; 20 class ScriptState;
21 class USBConfiguration; 21 class USBConfiguration;
22 class USBControlTransferParameters; 22 class USBControlTransferParameters;
23 23
24 class USBDevice 24 class USBDevice
25 : public GarbageCollectedFinalized<USBDevice> 25 : public GarbageCollectedFinalized<USBDevice>
26 , public ContextLifecycleObserver 26 , public ContextLifecycleObserver
27 , public ScriptWrappable { 27 , public ScriptWrappable {
28 USING_GARBAGE_COLLECTED_MIXIN(USBDevice); 28 USING_GARBAGE_COLLECTED_MIXIN(USBDevice);
29 DEFINE_WRAPPERTYPEINFO(); 29 DEFINE_WRAPPERTYPEINFO();
30 public: 30 public:
31 static USBDevice* create(device::usb::wtf::DeviceInfoPtr deviceInfo, device: :usb::wtf::DevicePtr device, ExecutionContext* context) 31 static USBDevice* create(device::usb::blink::DeviceInfoPtr deviceInfo, devic e::usb::blink::DevicePtr device, ExecutionContext* context)
32 { 32 {
33 return new USBDevice(std::move(deviceInfo), std::move(device), context); 33 return new USBDevice(std::move(deviceInfo), std::move(device), context);
34 } 34 }
35 35
36 explicit USBDevice(device::usb::wtf::DeviceInfoPtr, device::usb::wtf::Device Ptr, ExecutionContext*); 36 explicit USBDevice(device::usb::blink::DeviceInfoPtr, device::usb::blink::De vicePtr, ExecutionContext*);
37 virtual ~USBDevice(); 37 virtual ~USBDevice();
38 38
39 const device::usb::wtf::DeviceInfo& info() const { return *m_deviceInfo; } 39 const device::usb::blink::DeviceInfo& info() const { return *m_deviceInfo; }
40 bool isInterfaceClaimed(size_t configurationIndex, size_t interfaceIndex) co nst; 40 bool isInterfaceClaimed(size_t configurationIndex, size_t interfaceIndex) co nst;
41 size_t selectedAlternateInterface(size_t interfaceIndex) const; 41 size_t selectedAlternateInterface(size_t interfaceIndex) const;
42 42
43 // USBDevice.idl 43 // USBDevice.idl
44 String guid() const { return info().guid; } 44 String guid() const { return info().guid; }
45 uint8_t usbVersionMajor() const { return info().usb_version_major; } 45 uint8_t usbVersionMajor() const { return info().usb_version_major; }
46 uint8_t usbVersionMinor() const { return info().usb_version_minor; } 46 uint8_t usbVersionMinor() const { return info().usb_version_minor; }
47 uint8_t usbVersionSubminor() const { return info().usb_version_subminor; } 47 uint8_t usbVersionSubminor() const { return info().usb_version_subminor; }
48 uint8_t deviceClass() const { return info().class_code; } 48 uint8_t deviceClass() const { return info().class_code; }
49 uint8_t deviceSubclass() const { return info().subclass_code; } 49 uint8_t deviceSubclass() const { return info().subclass_code; }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 private: 84 private:
85 int findConfigurationIndex(uint8_t configurationValue) const; 85 int findConfigurationIndex(uint8_t configurationValue) const;
86 int findInterfaceIndex(uint8_t interfaceNumber) const; 86 int findInterfaceIndex(uint8_t interfaceNumber) const;
87 int findAlternateIndex(size_t interfaceIndex, uint8_t alternateSetting) cons t; 87 int findAlternateIndex(size_t interfaceIndex, uint8_t alternateSetting) cons t;
88 bool ensureNoDeviceOrInterfaceChangeInProgress(ScriptPromiseResolver*) const ; 88 bool ensureNoDeviceOrInterfaceChangeInProgress(ScriptPromiseResolver*) const ;
89 bool ensureDeviceConfigured(ScriptPromiseResolver*) const; 89 bool ensureDeviceConfigured(ScriptPromiseResolver*) const;
90 bool ensureInterfaceClaimed(uint8_t interfaceNumber, ScriptPromiseResolver*) const; 90 bool ensureInterfaceClaimed(uint8_t interfaceNumber, ScriptPromiseResolver*) const;
91 bool ensureEndpointAvailable(bool inTransfer, uint8_t endpointNumber, Script PromiseResolver*) const; 91 bool ensureEndpointAvailable(bool inTransfer, uint8_t endpointNumber, Script PromiseResolver*) const;
92 bool anyInterfaceChangeInProgress() const; 92 bool anyInterfaceChangeInProgress() const;
93 device::usb::wtf::ControlTransferParamsPtr convertControlTransferParameters( const USBControlTransferParameters&, ScriptPromiseResolver*) const; 93 device::usb::blink::ControlTransferParamsPtr convertControlTransferParameter s(const USBControlTransferParameters&, ScriptPromiseResolver*) const;
94 void setEndpointsForInterface(size_t interfaceIndex, bool set); 94 void setEndpointsForInterface(size_t interfaceIndex, bool set);
95 95
96 void asyncOpen(ScriptPromiseResolver*, device::usb::wtf::OpenDeviceError); 96 void asyncOpen(ScriptPromiseResolver*, device::usb::blink::OpenDeviceError);
97 void asyncClose(ScriptPromiseResolver*); 97 void asyncClose(ScriptPromiseResolver*);
98 void onDeviceOpenedOrClosed(bool); 98 void onDeviceOpenedOrClosed(bool);
99 void asyncSelectConfiguration(size_t configurationIndex, ScriptPromiseResolv er*, bool success); 99 void asyncSelectConfiguration(size_t configurationIndex, ScriptPromiseResolv er*, bool success);
100 void onConfigurationSelected(bool success, size_t configurationIndex); 100 void onConfigurationSelected(bool success, size_t configurationIndex);
101 void asyncClaimInterface(size_t interfaceIndex, ScriptPromiseResolver*, bool success); 101 void asyncClaimInterface(size_t interfaceIndex, ScriptPromiseResolver*, bool success);
102 void asyncReleaseInterface(size_t interfaceIndex, ScriptPromiseResolver*, bo ol success); 102 void asyncReleaseInterface(size_t interfaceIndex, ScriptPromiseResolver*, bo ol success);
103 void onInterfaceClaimedOrUnclaimed(bool claimed, size_t interfaceIndex); 103 void onInterfaceClaimedOrUnclaimed(bool claimed, size_t interfaceIndex);
104 void asyncSelectAlternateInterface(size_t interfaceIndex, size_t alternateIn dex, ScriptPromiseResolver*, bool success); 104 void asyncSelectAlternateInterface(size_t interfaceIndex, size_t alternateIn dex, ScriptPromiseResolver*, bool success);
105 void asyncControlTransferIn(ScriptPromiseResolver*, device::usb::wtf::Transf erStatus, mojo::WTFArray<uint8_t>); 105 void asyncControlTransferIn(ScriptPromiseResolver*, device::usb::blink::Tran sferStatus, mojo::WTFArray<uint8_t>);
106 void asyncControlTransferOut(unsigned, ScriptPromiseResolver*, device::usb:: wtf::TransferStatus); 106 void asyncControlTransferOut(unsigned, ScriptPromiseResolver*, device::usb:: blink::TransferStatus);
107 void asyncClearHalt(ScriptPromiseResolver*, bool success); 107 void asyncClearHalt(ScriptPromiseResolver*, bool success);
108 void asyncTransferIn(ScriptPromiseResolver*, device::usb::wtf::TransferStatu s, mojo::WTFArray<uint8_t>); 108 void asyncTransferIn(ScriptPromiseResolver*, device::usb::blink::TransferSta tus, mojo::WTFArray<uint8_t>);
109 void asyncTransferOut(unsigned, ScriptPromiseResolver*, device::usb::wtf::Tr ansferStatus); 109 void asyncTransferOut(unsigned, ScriptPromiseResolver*, device::usb::blink:: TransferStatus);
110 void asyncIsochronousTransferIn(ScriptPromiseResolver*, mojo::WTFArray<uint8 _t>, mojo::WTFArray<device::usb::wtf::IsochronousPacketPtr>); 110 void asyncIsochronousTransferIn(ScriptPromiseResolver*, mojo::WTFArray<uint8 _t>, mojo::WTFArray<device::usb::blink::IsochronousPacketPtr>);
111 void asyncIsochronousTransferOut(ScriptPromiseResolver*, mojo::WTFArray<devi ce::usb::wtf::IsochronousPacketPtr>); 111 void asyncIsochronousTransferOut(ScriptPromiseResolver*, mojo::WTFArray<devi ce::usb::blink::IsochronousPacketPtr>);
112 void asyncReset(ScriptPromiseResolver*, bool success); 112 void asyncReset(ScriptPromiseResolver*, bool success);
113 113
114 void onConnectionError(); 114 void onConnectionError();
115 115
116 device::usb::wtf::DeviceInfoPtr m_deviceInfo; 116 device::usb::blink::DeviceInfoPtr m_deviceInfo;
117 device::usb::wtf::DevicePtr m_device; 117 device::usb::blink::DevicePtr m_device;
118 HeapHashSet<Member<ScriptPromiseResolver>> m_deviceRequests; 118 HeapHashSet<Member<ScriptPromiseResolver>> m_deviceRequests;
119 bool m_opened; 119 bool m_opened;
120 bool m_deviceStateChangeInProgress; 120 bool m_deviceStateChangeInProgress;
121 int m_configurationIndex; 121 int m_configurationIndex;
122 WTF::BitVector m_claimedInterfaces; 122 WTF::BitVector m_claimedInterfaces;
123 WTF::BitVector m_interfaceStateChangeInProgress; 123 WTF::BitVector m_interfaceStateChangeInProgress;
124 WTF::Vector<size_t> m_selectedAlternates; 124 WTF::Vector<size_t> m_selectedAlternates;
125 WTF::BitVector m_inEndpoints; 125 WTF::BitVector m_inEndpoints;
126 WTF::BitVector m_outEndpoints; 126 WTF::BitVector m_outEndpoints;
127 }; 127 };
128 128
129 } // namespace blink 129 } // namespace blink
130 130
131 #endif // USBDevice_h 131 #endif // USBDevice_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webusb/USBConfiguration.cpp ('k') | third_party/WebKit/Source/modules/webusb/USBDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698