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

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

Issue 1730403006: Basic layout tests for WebUSB. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Mojo tests that depend on extra module loading. 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
« no previous file with comments | « third_party/WebKit/Source/modules/webusb/USBDevice.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 USBIsochronousInTransferResult_h 5 #ifndef USBIsochronousInTransferResult_h
6 #define USBIsochronousInTransferResult_h 6 #define USBIsochronousInTransferResult_h
7 7
8 #include "bindings/core/v8/ScriptWrappable.h" 8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "core/dom/DOMArrayBuffer.h" 9 #include "core/dom/DOMArrayBuffer.h"
10 #include "core/dom/DOMDataView.h" 10 #include "core/dom/DOMDataView.h"
11 #include "modules/webusb/USBIsochronousInTransferPacket.h" 11 #include "modules/webusb/USBIsochronousInTransferPacket.h"
12 #include "platform/heap/Handle.h" 12 #include "platform/heap/Handle.h"
13 #include "wtf/text/WTFString.h" 13 #include "wtf/text/WTFString.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 class USBIsochronousInTransferResult final : public GarbageCollectedFinalized<US BIsochronousInTransferResult>, public ScriptWrappable { 17 class USBIsochronousInTransferResult final : public GarbageCollectedFinalized<US BIsochronousInTransferResult>, public ScriptWrappable {
18 DEFINE_WRAPPERTYPEINFO(); 18 DEFINE_WRAPPERTYPEINFO();
19 public: 19 public:
20 static USBIsochronousInTransferResult* create(PassRefPtr<DOMArrayBuffer> dat a, const HeapVector<Member<USBIsochronousInTransferPacket>>& packets) 20 static USBIsochronousInTransferResult* create(PassRefPtr<DOMArrayBuffer> dat a, const HeapVector<Member<USBIsochronousInTransferPacket>>& packets)
21 { 21 {
22 return new USBIsochronousInTransferResult(data, packets); 22 return new USBIsochronousInTransferResult(data, packets);
23 } 23 }
24 24
25 USBIsochronousInTransferResult(PassRefPtr<DOMArrayBuffer> data, const HeapVe ctor<Member<USBIsochronousInTransferPacket>>& packets) 25 USBIsochronousInTransferResult(PassRefPtr<DOMArrayBuffer> data, const HeapVe ctor<Member<USBIsochronousInTransferPacket>>& packets)
26 : m_data(DOMDataView::create(data, 0, data->byteLength())) 26 : m_packets(packets)
27 , m_packets(packets)
28 { 27 {
28 unsigned byteLength = data->byteLength();
29 m_data = DOMDataView::create(data, 0, byteLength);
29 } 30 }
30 31
31 virtual ~USBIsochronousInTransferResult() {} 32 virtual ~USBIsochronousInTransferResult() {}
32 33
33 PassRefPtr<DOMDataView> data() const { return m_data; } 34 PassRefPtr<DOMDataView> data() const { return m_data; }
34 const HeapVector<Member<USBIsochronousInTransferPacket>>& packets() const 35 const HeapVector<Member<USBIsochronousInTransferPacket>>& packets() const
35 { 36 {
36 return m_packets; 37 return m_packets;
37 } 38 }
38 39
39 DEFINE_INLINE_TRACE() { visitor->trace(m_packets); } 40 DEFINE_INLINE_TRACE() { visitor->trace(m_packets); }
40 41
41 private: 42 private:
42 const RefPtr<DOMDataView> m_data; 43 RefPtr<DOMDataView> m_data;
43 const HeapVector<Member<USBIsochronousInTransferPacket>> m_packets; 44 const HeapVector<Member<USBIsochronousInTransferPacket>> m_packets;
44 }; 45 };
45 46
46 } // namespace blink 47 } // namespace blink
47 48
48 #endif // USBIsochronousInTransferResult_h 49 #endif // USBIsochronousInTransferResult_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webusb/USBDevice.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698