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

Unified Diff: Source/modules/bluetooth/ConvertWebVectorToArrayBuffer.cpp

Issue 1147243004: bluetooth: readValue Blink implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@bluetooth-read-value-interface
Patch Set: Fix Web Exposed Layout Test Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/bluetooth/ConvertWebVectorToArrayBuffer.h ('k') | Source/modules/modules.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/modules/bluetooth/ConvertWebVectorToArrayBuffer.h ('k') | Source/modules/modules.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698