| Index: Source/modules/bluetooth/ConvertWebVectorToArrayBuffer.cpp
|
| diff --git a/Source/modules/bluetooth/ConvertWebVectorToArrayBuffer.cpp b/Source/modules/bluetooth/ConvertWebVectorToArrayBuffer.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..87d2101748bf92dd3b521d54ed39d4be11852d84
|
| --- /dev/null
|
| +++ b/Source/modules/bluetooth/ConvertWebVectorToArrayBuffer.cpp
|
| @@ -0,0 +1,28 @@
|
| +// Copyright 2015 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/ConvertWebVectorToArrayBuffer.h"
|
| +
|
| +#include "wtf/OwnPtr.h"
|
| +
|
| +namespace blink {
|
| +
|
| +PassRefPtr<DOMArrayBuffer> ConvertWebVectorToArrayBuffer::take(ScriptPromiseResolver*, WebVector<uint8_t>* webVectorRawPointer)
|
| +{
|
| + OwnPtr<WebVector<uint8_t>> webVector = adoptPtr(webVectorRawPointer);
|
| +
|
| + 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 ConvertWebVectorToArrayBuffer::dispose(WebVector<uint8_t>* webBufferRaw)
|
| +{
|
| + delete webBufferRaw;
|
| +}
|
| +
|
| +} // namespace blink
|
|
|