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

Side by Side Diff: Source/modules/bluetooth/BluetoothArrayBuffer.cpp

Issue 1147243004: bluetooth: readValue Blink implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@bluetooth-read-value-interface
Patch Set: Address jyasskin's comments 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "modules/bluetooth/BluetoothArrayBuffer.h"
7
8 #include "wtf/OwnPtr.h"
9
10 namespace blink {
11
12 PassRefPtr<DOMArrayBuffer> BluetoothArrayBuffer::take(ScriptPromiseResolver*, We bVector<uint8_t>* webVectorRawPointer)
13 {
14 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
15
16 static_assert(sizeof(*webVector->data()) == 1, "uint8_t should be a single b yte");
17
18 RefPtr<DOMArrayBuffer> domBuffer = DOMArrayBuffer::create(webVector->data(), webVector->size());
19
20 return domBuffer;
21 }
22
23 void BluetoothArrayBuffer::dispose(WebVector<uint8_t>* webBufferRaw)
24 {
25 delete webBufferRaw;
26 }
27
28 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698