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

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

Issue 1964183004: Revert of Move DOMArrayBuffer, DOMArrayBufferViews and DataView to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 #include "modules/webusb/USBDevice.h" 5 #include "modules/webusb/USBDevice.h"
6 6
7 #include "bindings/core/v8/CallbackPromiseAdapter.h" 7 #include "bindings/core/v8/CallbackPromiseAdapter.h"
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "bindings/core/v8/ToV8.h" 10 #include "bindings/core/v8/ToV8.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 208
209 class IsochronousInputTransferResult { 209 class IsochronousInputTransferResult {
210 WTF_MAKE_NONCOPYABLE(IsochronousInputTransferResult); 210 WTF_MAKE_NONCOPYABLE(IsochronousInputTransferResult);
211 211
212 public: 212 public:
213 using WebType = OwnPtr<WebUSBTransferInfo>; 213 using WebType = OwnPtr<WebUSBTransferInfo>;
214 214
215 static USBIsochronousInTransferResult* take(ScriptPromiseResolver*, PassOwnP tr<WebUSBTransferInfo> webTransferInfo) 215 static USBIsochronousInTransferResult* take(ScriptPromiseResolver*, PassOwnP tr<WebUSBTransferInfo> webTransferInfo)
216 { 216 {
217 ASSERT(webTransferInfo->status.size() == webTransferInfo->packetLength.s ize() && webTransferInfo->packetLength.size() == webTransferInfo->bytesTransferr ed.size()); 217 ASSERT(webTransferInfo->status.size() == webTransferInfo->packetLength.s ize() && webTransferInfo->packetLength.size() == webTransferInfo->bytesTransferr ed.size());
218 DOMArrayBuffer* buffer = DOMArrayBuffer::create(webTransferInfo->data.da ta(), webTransferInfo->data.size()); 218 RefPtr<DOMArrayBuffer> buffer = DOMArrayBuffer::create(webTransferInfo-> data.data(), webTransferInfo->data.size());
219 HeapVector<Member<USBIsochronousInTransferPacket>> packets(webTransferIn fo->status.size()); 219 HeapVector<Member<USBIsochronousInTransferPacket>> packets(webTransferIn fo->status.size());
220 size_t byteOffset = 0; 220 size_t byteOffset = 0;
221 for (size_t i = 0; i < webTransferInfo->status.size(); ++i) { 221 for (size_t i = 0; i < webTransferInfo->status.size(); ++i) {
222 packets[i] = USBIsochronousInTransferPacket::create(convertTransferS tatus(webTransferInfo->status[i]), DOMDataView::create(buffer, byteOffset, webTr ansferInfo->bytesTransferred[i])); 222 packets[i] = USBIsochronousInTransferPacket::create(convertTransferS tatus(webTransferInfo->status[i]), DOMDataView::create(buffer, byteOffset, webTr ansferInfo->bytesTransferred[i]));
223 byteOffset += webTransferInfo->packetLength[i]; 223 byteOffset += webTransferInfo->packetLength[i];
224 } 224 }
225 return USBIsochronousInTransferResult::create(buffer, packets); 225 return USBIsochronousInTransferResult::create(buffer, packets);
226 } 226 }
227 }; 227 };
228 228
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 continue; // Ignore endpoints with invalid indices. 741 continue; // Ignore endpoints with invalid indices.
742 auto& bitVector = endpoint.direction == WebUSBDevice::TransferDirection: :In ? m_inEndpoints : m_outEndpoints; 742 auto& bitVector = endpoint.direction == WebUSBDevice::TransferDirection: :In ? m_inEndpoints : m_outEndpoints;
743 if (set) 743 if (set)
744 bitVector.set(endpoint.endpointNumber - 1); 744 bitVector.set(endpoint.endpointNumber - 1);
745 else 745 else
746 bitVector.clear(endpoint.endpointNumber - 1); 746 bitVector.clear(endpoint.endpointNumber - 1);
747 } 747 }
748 } 748 }
749 749
750 } // namespace blink 750 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698