| 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 8fef103f1ec53ec516ad048d1226023dc98134da..cbeab082164b8bd3b77444bbfc3153bb30b704c7 100644
|
| --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothAttributeInstanceMap.cpp
|
| +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothAttributeInstanceMap.cpp
|
| @@ -6,6 +6,7 @@
|
|
|
| #include "modules/bluetooth/BluetoothDevice.h"
|
| #include "modules/bluetooth/BluetoothRemoteGATTService.h"
|
| +#include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTCharacteristicInit.h"
|
| #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTService.h"
|
| #include <memory>
|
| #include <utility>
|
| @@ -38,6 +39,25 @@ bool BluetoothAttributeInstanceMap::containsService(
|
| return m_serviceIdToObject.contains(serviceInstanceId);
|
| }
|
|
|
| +BluetoothRemoteGATTCharacteristic*
|
| +BluetoothAttributeInstanceMap::getOrCreateBluetoothRemoteGATTCharacteristic(
|
| + ExecutionContext* context,
|
| + std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit> webCharacteristic,
|
| + BluetoothRemoteGATTService* service) {
|
| + String characteristicInstanceId = webCharacteristic->characteristicInstanceID;
|
| +
|
| + BluetoothRemoteGATTCharacteristic* characteristic =
|
| + m_characteristicIdToObject.get(characteristicInstanceId);
|
| +
|
| + if (!characteristic) {
|
| + characteristic = BluetoothRemoteGATTCharacteristic::create(
|
| + context, std::move(webCharacteristic), service);
|
| + m_characteristicIdToObject.add(characteristicInstanceId, characteristic);
|
| + }
|
| +
|
| + return characteristic;
|
| +}
|
| +
|
| void BluetoothAttributeInstanceMap::Clear() {
|
| m_serviceIdToObject.clear();
|
| }
|
| @@ -45,6 +65,7 @@ void BluetoothAttributeInstanceMap::Clear() {
|
| DEFINE_TRACE(BluetoothAttributeInstanceMap) {
|
| visitor->trace(m_device);
|
| visitor->trace(m_serviceIdToObject);
|
| + visitor->trace(m_characteristicIdToObject);
|
| }
|
|
|
| } // namespace blink
|
|
|