Chromium Code Reviews| 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 |