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

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

Issue 2474863004: bluetooth: Add characteristics to the device's attribute instance map (Closed)
Patch Set: clean up Created 4 years, 1 month 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.h
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothAttributeInstanceMap.h b/third_party/WebKit/Source/modules/bluetooth/BluetoothAttributeInstanceMap.h
index cb82118dc437a39d63a7e4ab869e9569c9b903a4..4c5276bcdd3bce30b00c896fecff0336d355bf80 100644
--- a/third_party/WebKit/Source/modules/bluetooth/BluetoothAttributeInstanceMap.h
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothAttributeInstanceMap.h
@@ -5,6 +5,7 @@
#ifndef BluetoothAttributeInstanceMap_h
#define BluetoothAttributeInstanceMap_h
+#include "modules/bluetooth/BluetoothRemoteGATTCharacteristic.h"
#include "modules/bluetooth/BluetoothRemoteGATTService.h"
#include "platform/heap/Handle.h"
#include "platform/heap/Heap.h"
@@ -13,7 +14,10 @@
namespace blink {
class BluetoothDevice;
+class ExecutionContext;
class ScriptPromiseResolver;
+
+struct WebBluetoothRemoteGATTCharacteristicInit;
struct WebBluetoothRemoteGATTService;
// Map that holds all GATT attributes, i.e. BluetoothRemoteGATTService,
@@ -36,6 +40,16 @@ class BluetoothAttributeInstanceMap final
// is in the map.
bool containsService(const String& serviceInstanceId);
+ // Constructs a new BluetoothRemoteGATTCharacteristic object if there was no
+ // characteristic with the same instance id and adds it to the map.
+ // Otherwise returns the BluetoothRemoteGATTCharacteristic object already in
+ // the map.
+ BluetoothRemoteGATTCharacteristic*
+ getOrCreateBluetoothRemoteGATTCharacteristic(
+ ExecutionContext*,
+ std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit>,
+ BluetoothRemoteGATTService*);
+
// Removes all Attributes from the map.
// TODO(crbug.com/654950): Remove characteristics and descriptors when
// implemented.
@@ -48,6 +62,9 @@ class BluetoothAttributeInstanceMap final
Member<BluetoothDevice> m_device;
// Map of service instance ids to objects.
HeapHashMap<String, Member<BluetoothRemoteGATTService>> m_serviceIdToObject;
+ // Map of characteristic instance ids to objects.
+ HeapHashMap<String, Member<BluetoothRemoteGATTCharacteristic>>
+ m_characteristicIdToObject;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698