OLD | NEW |
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 "config.h" | 5 #include "config.h" |
6 #include "modules/bluetooth/BluetoothGATTCharacteristic.h" | 6 #include "modules/bluetooth/BluetoothGATTCharacteristic.h" |
7 | 7 |
8 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 8 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
10 #include "bindings/core/v8/ScriptPromiseResolver.h" | 10 #include "bindings/core/v8/ScriptPromiseResolver.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 // See note in ActiveDOMObject about suspendIfNeeded. | 38 // See note in ActiveDOMObject about suspendIfNeeded. |
39 characteristic->suspendIfNeeded(); | 39 characteristic->suspendIfNeeded(); |
40 return characteristic; | 40 return characteristic; |
41 } | 41 } |
42 | 42 |
43 void BluetoothGATTCharacteristic::dispatchCharacteristicValueChanged( | 43 void BluetoothGATTCharacteristic::dispatchCharacteristicValueChanged( |
44 const WebVector<uint8_t>& value) | 44 const WebVector<uint8_t>& value) |
45 { | 45 { |
46 static_assert(sizeof(*value.data()) == 1, "uint8_t should be a single byte")
; | 46 static_assert(sizeof(*value.data()) == 1, "uint8_t should be a single byte")
; |
47 | 47 |
48 m_value = DOMArrayBuffer::create(value.data(), value.size()); | 48 // FIXME: Should use createOrNull. Requires figuring out a graceful way |
| 49 // to handle allocation failures. |
| 50 m_value = DOMArrayBuffer::deprecatedCreateOrCrash(value.data(), value.size()
); |
49 | 51 |
50 dispatchEvent(Event::create(EventTypeNames::characteristicvaluechanged)); | 52 dispatchEvent(Event::create(EventTypeNames::characteristicvaluechanged)); |
51 } | 53 } |
52 | 54 |
53 void BluetoothGATTCharacteristic::stop() | 55 void BluetoothGATTCharacteristic::stop() |
54 { | 56 { |
55 notifyCharacteristicObjectRemoved(); | 57 notifyCharacteristicObjectRemoved(); |
56 } | 58 } |
57 | 59 |
58 void BluetoothGATTCharacteristic::dispose() | 60 void BluetoothGATTCharacteristic::dispose() |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 } | 144 } |
143 | 145 |
144 DEFINE_TRACE(BluetoothGATTCharacteristic) | 146 DEFINE_TRACE(BluetoothGATTCharacteristic) |
145 { | 147 { |
146 RefCountedGarbageCollectedEventTargetWithInlineData<BluetoothGATTCharacteris
tic>::trace(visitor); | 148 RefCountedGarbageCollectedEventTargetWithInlineData<BluetoothGATTCharacteris
tic>::trace(visitor); |
147 ActiveDOMObject::trace(visitor); | 149 ActiveDOMObject::trace(visitor); |
148 visitor->trace(m_properties); | 150 visitor->trace(m_properties); |
149 } | 151 } |
150 | 152 |
151 } // namespace blink | 153 } // namespace blink |
OLD | NEW |