| 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 f58be91213ca31276baaaa8b454be0eae341644e..4a32e2bcec730243ecb1f328cf489c88d34c1f24 100644
|
| --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothAttributeInstanceMap.cpp
|
| +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothAttributeInstanceMap.cpp
|
| @@ -7,6 +7,8 @@
|
| #include "modules/bluetooth/BluetoothDevice.h"
|
| #include "modules/bluetooth/BluetoothRemoteGATTService.h"
|
| #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTCharacteristicInit.h"
|
| +#include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTDescriptorInit.h"
|
| +
|
| #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTService.h"
|
| #include <memory>
|
| #include <utility>
|
| @@ -63,15 +65,40 @@ bool BluetoothAttributeInstanceMap::containsCharacteristic(
|
| return m_characteristicIdToObject.contains(characteristicInstanceId);
|
| }
|
|
|
| +BluetoothRemoteGATTDescriptor*
|
| +BluetoothAttributeInstanceMap::getOrCreateBluetoothRemoteGATTDescriptor(
|
| + std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit> webDescriptor,
|
| + BluetoothRemoteGATTCharacteristic* characteristic) {
|
| + String descriptorInstanceId = webDescriptor->descriptorInstanceID;
|
| +
|
| + BluetoothRemoteGATTDescriptor* descriptor =
|
| + m_descriptorIdToObject.get(descriptorInstanceId);
|
| +
|
| + if (!descriptor) {
|
| + descriptor = BluetoothRemoteGATTDescriptor::create(std::move(webDescriptor),
|
| + characteristic);
|
| + m_descriptorIdToObject.add(descriptorInstanceId, descriptor);
|
| + }
|
| +
|
| + return descriptor;
|
| +}
|
| +
|
| +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
|
|
|