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

Unified Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp

Issue 1878463002: Move DOMArrayBuffer, DOMArrayBufferViews and DataView to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tidy Created 4 years, 8 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
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 1a34791f59f73b7a196bf1effd58fcdae30d60d6..7d76e5dcc1e0dd1a7c516dcc41b3b92523bd8c48 100644
--- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp
@@ -20,13 +20,11 @@ namespace blink {
namespace {
-PassRefPtr<DOMDataView> ConvertWebVectorToDataView(
- const WebVector<uint8_t>& webVector)
+DOMDataView* ConvertWebVectorToDataView(const WebVector<uint8_t>& webVector)
{
static_assert(sizeof(*webVector.data()) == 1, "uint8_t should be a single byte");
- RefPtr<DOMArrayBuffer> domBuffer = DOMArrayBuffer::create(webVector.data(), webVector.size());
- RefPtr<DOMDataView> domDataView = DOMDataView::create(domBuffer, 0, webVector.size());
- return domDataView;
+ DOMArrayBuffer* domBuffer = DOMArrayBuffer::create(webVector.data(), webVector.size());
+ return DOMDataView::create(domBuffer, 0, webVector.size());
}
} // anonymous namespace
@@ -52,8 +50,7 @@ BluetoothRemoteGATTCharacteristic* BluetoothRemoteGATTCharacteristic::take(Scrip
return characteristic;
}
-void BluetoothRemoteGATTCharacteristic::setValue(
- const PassRefPtr<DOMDataView>& domDataView)
+void BluetoothRemoteGATTCharacteristic::setValue(DOMDataView* domDataView)
{
m_value = domDataView;
}
@@ -61,8 +58,7 @@ void BluetoothRemoteGATTCharacteristic::setValue(
void BluetoothRemoteGATTCharacteristic::dispatchCharacteristicValueChanged(
const WebVector<uint8_t>& value)
{
- RefPtr<DOMDataView> domDataView = ConvertWebVectorToDataView(value);
- this->setValue(domDataView);
+ this->setValue(ConvertWebVectorToDataView(value));
dispatchEvent(Event::create(EventTypeNames::characteristicvaluechanged));
}
@@ -115,10 +111,10 @@ public:
if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped())
return;
- RefPtr<DOMDataView> domDataView = ConvertWebVectorToDataView(value);
- if (m_webCharacteristic) {
+ DOMDataView* domDataView = ConvertWebVectorToDataView(value);
+ if (m_webCharacteristic)
m_webCharacteristic->setValue(domDataView);
- }
+
m_resolver->resolve(domDataView);
ortuno 2016/04/10 17:53:37 Just to make sure I understand this: Calling m_web
sof 2016/04/10 18:12:51 DOMDataView is on the Oilpan heap, so there's no r
ortuno 2016/04/10 18:15:52 Got it. Thanks! Bluetooth LGTM
}
@@ -215,9 +211,10 @@ ScriptPromise BluetoothRemoteGATTCharacteristic::stopNotifications(ScriptState*
DEFINE_TRACE(BluetoothRemoteGATTCharacteristic)
{
+ visitor->trace(m_properties);
+ visitor->trace(m_value);
RefCountedGarbageCollectedEventTargetWithInlineData<BluetoothRemoteGATTCharacteristic>::trace(visitor);
ActiveDOMObject::trace(visitor);
- visitor->trace(m_properties);
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698