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

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

Issue 2466223002: Implement WebBluetooth getDescriptor[s] (Closed)
Patch Set: Implement WebBluetooth getDescriptor[s] Created 3 years, 11 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/BluetoothAttributeInstanceMap.cpp
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothAttributeInstanceMap.cpp b/third_party/WebKit/Source/modules/bluetooth/BluetoothAttributeInstanceMap.cpp
index dcc7a52da0030683533231be4c45b590751e7560..1326f66c554bf09e694ac5d5cc2b3d92bf724245 100644
--- a/third_party/WebKit/Source/modules/bluetooth/BluetoothAttributeInstanceMap.cpp
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothAttributeInstanceMap.cpp
@@ -62,15 +62,39 @@ bool BluetoothAttributeInstanceMap::containsCharacteristic(
return m_characteristicIdToObject.contains(characteristicInstanceId);
}
+BluetoothRemoteGATTDescriptor*
+BluetoothAttributeInstanceMap::getOrCreateBluetoothRemoteGATTDescriptor(
+ mojom::blink::WebBluetoothRemoteGATTDescriptorPtr descriptor,
+ BluetoothRemoteGATTCharacteristic* characteristic) {
+ String instanceId = descriptor->instance_id;
dcheng 2017/01/13 22:48:33 nit: const String& so it's just a cheap alias? (S
dougt 2017/01/14 02:34:20 That goes boom. |descriptor| is std::moved into a
+ BluetoothRemoteGATTDescriptor* result =
+ m_descriptorIdToObject.get(instanceId);
+
+ if (result)
+ return result;
+
+ result =
+ new BluetoothRemoteGATTDescriptor(std::move(descriptor), characteristic);
+ m_descriptorIdToObject.add(instanceId, result);
+ return result;
+}
+
+bool BluetoothAttributeInstanceMap::containsDescriptor(
+ const String& descriptorInstanceId) {
+ return m_descriptorIdToObject.contains(descriptorInstanceId);
+}
+
void BluetoothAttributeInstanceMap::Clear() {
m_serviceIdToObject.clear();
m_characteristicIdToObject.clear();
+ m_descriptorIdToObject.clear();
}
DEFINE_TRACE(BluetoothAttributeInstanceMap) {
visitor->trace(m_device);
visitor->trace(m_serviceIdToObject);
visitor->trace(m_characteristicIdToObject);
+ visitor->trace(m_descriptorIdToObject);
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698