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

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

Issue 1878463002: Move DOMArrayBuffer, DOMArrayBufferViews and DataView to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tidy Created 4 years, 8 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 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(DOMArrayBuffer* data, const He apVector<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(DOMArrayBuffer* data, const HeapVector<Member <USBIsochronousInTransferPacket>>& packets)
26 : m_packets(packets) 26 : m_packets(packets)
27 { 27 {
28 unsigned byteLength = data->byteLength(); 28 unsigned byteLength = data->byteLength();
29 m_data = DOMDataView::create(data, 0, byteLength); 29 m_data = DOMDataView::create(data, 0, byteLength);
30 } 30 }
31 31
32 virtual ~USBIsochronousInTransferResult() {} 32 virtual ~USBIsochronousInTransferResult() {}
33 33
34 PassRefPtr<DOMDataView> data() const { return m_data; } 34 DOMDataView* data() const { return m_data; }
35 const HeapVector<Member<USBIsochronousInTransferPacket>>& packets() const 35 const HeapVector<Member<USBIsochronousInTransferPacket>>& packets() const
36 { 36 {
37 return m_packets; 37 return m_packets;
38 } 38 }
39 39
40 DEFINE_INLINE_TRACE() { visitor->trace(m_packets); } 40 DEFINE_INLINE_TRACE()
41 {
42 visitor->trace(m_data);
43 visitor->trace(m_packets);
44 }
41 45
42 private: 46 private:
43 RefPtr<DOMDataView> m_data; 47 Member<DOMDataView> m_data;
44 const HeapVector<Member<USBIsochronousInTransferPacket>> m_packets; 48 const HeapVector<Member<USBIsochronousInTransferPacket>> m_packets;
45 }; 49 };
46 50
47 } // namespace blink 51 } // namespace blink
48 52
49 #endif // USBIsochronousInTransferResult_h 53 #endif // USBIsochronousInTransferResult_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698