Chromium Code Reviews| Index: Source/modules/bluetooth/BluetoothArrayBuffer.cpp |
| diff --git a/Source/modules/bluetooth/BluetoothArrayBuffer.cpp b/Source/modules/bluetooth/BluetoothArrayBuffer.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..89ef56cc148f82bfc38f1c24e97410b607ff4388 |
| --- /dev/null |
| +++ b/Source/modules/bluetooth/BluetoothArrayBuffer.cpp |
| @@ -0,0 +1,28 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "config.h" |
| +#include "modules/bluetooth/BluetoothArrayBuffer.h" |
| + |
| +#include "wtf/OwnPtr.h" |
| + |
| +namespace blink { |
| + |
| +PassRefPtr<DOMArrayBuffer> BluetoothArrayBuffer::take(ScriptPromiseResolver*, WebVector<uint8_t>* webVectorRawPointer) |
| +{ |
| + OwnPtr<WebVector<uint8_t>> webVector = adoptPtr(webVectorRawPointer); |
|
haraken
2015/06/11 01:13:13
OwnPtr<WebVector> looks really weird. WebVector an
ortuno
2015/06/11 02:56:33
Both CallbackPromiseAdapter and WebCallbacks requi
haraken
2015/06/11 03:34:26
Yeah. BTW, why do we need this OwnPtr? Can we just
nhiroki
2015/06/11 04:01:01
Updated my current status in the issue:
https://co
ortuno
2015/06/11 16:24:40
I could but then I would have to manually delete w
haraken
2015/06/11 23:23:53
Ah, understood. I hope that the manual lifetime ma
|
| + |
| + static_assert(sizeof(*webVector->data()) == 1, "uint8_t should be a single byte"); |
| + |
| + RefPtr<DOMArrayBuffer> domBuffer = DOMArrayBuffer::create(webVector->data(), webVector->size()); |
| + |
| + return domBuffer; |
| +} |
| + |
| +void BluetoothArrayBuffer::dispose(WebVector<uint8_t>* webBufferRaw) |
| +{ |
| + delete webBufferRaw; |
| +} |
| + |
| +} // namespace blink |