Index: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp |
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp |
index 7d76e5dcc1e0dd1a7c516dcc41b3b92523bd8c48..1a34791f59f73b7a196bf1effd58fcdae30d60d6 100644 |
--- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp |
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp |
@@ -20,11 +20,13 @@ |
namespace { |
-DOMDataView* ConvertWebVectorToDataView(const WebVector<uint8_t>& webVector) |
+PassRefPtr<DOMDataView> ConvertWebVectorToDataView( |
+ const WebVector<uint8_t>& webVector) |
{ |
static_assert(sizeof(*webVector.data()) == 1, "uint8_t should be a single byte"); |
- DOMArrayBuffer* domBuffer = DOMArrayBuffer::create(webVector.data(), webVector.size()); |
- return DOMDataView::create(domBuffer, 0, webVector.size()); |
+ RefPtr<DOMArrayBuffer> domBuffer = DOMArrayBuffer::create(webVector.data(), webVector.size()); |
+ RefPtr<DOMDataView> domDataView = DOMDataView::create(domBuffer, 0, webVector.size()); |
+ return domDataView; |
} |
} // anonymous namespace |
@@ -50,7 +52,8 @@ |
return characteristic; |
} |
-void BluetoothRemoteGATTCharacteristic::setValue(DOMDataView* domDataView) |
+void BluetoothRemoteGATTCharacteristic::setValue( |
+ const PassRefPtr<DOMDataView>& domDataView) |
{ |
m_value = domDataView; |
} |
@@ -58,7 +61,8 @@ |
void BluetoothRemoteGATTCharacteristic::dispatchCharacteristicValueChanged( |
const WebVector<uint8_t>& value) |
{ |
- this->setValue(ConvertWebVectorToDataView(value)); |
+ RefPtr<DOMDataView> domDataView = ConvertWebVectorToDataView(value); |
+ this->setValue(domDataView); |
dispatchEvent(Event::create(EventTypeNames::characteristicvaluechanged)); |
} |
@@ -111,10 +115,10 @@ |
if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) |
return; |
- DOMDataView* domDataView = ConvertWebVectorToDataView(value); |
- if (m_webCharacteristic) |
+ RefPtr<DOMDataView> domDataView = ConvertWebVectorToDataView(value); |
+ if (m_webCharacteristic) { |
m_webCharacteristic->setValue(domDataView); |
- |
+ } |
m_resolver->resolve(domDataView); |
} |
@@ -211,10 +215,9 @@ |
DEFINE_TRACE(BluetoothRemoteGATTCharacteristic) |
{ |
- visitor->trace(m_properties); |
- visitor->trace(m_value); |
RefCountedGarbageCollectedEventTargetWithInlineData<BluetoothRemoteGATTCharacteristic>::trace(visitor); |
ActiveDOMObject::trace(visitor); |
+ visitor->trace(m_properties); |
} |
} // namespace blink |