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

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

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.h
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothAttributeInstanceMap.h b/third_party/WebKit/Source/modules/bluetooth/BluetoothAttributeInstanceMap.h
index b5bfd9aa6390a3df52163053530b157e02bea765..d8a3b46b2179721e9843e5d960715e52fba855a7 100644
--- a/third_party/WebKit/Source/modules/bluetooth/BluetoothAttributeInstanceMap.h
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothAttributeInstanceMap.h
@@ -6,6 +6,7 @@
#define BluetoothAttributeInstanceMap_h
#include "modules/bluetooth/BluetoothRemoteGATTCharacteristic.h"
+#include "modules/bluetooth/BluetoothRemoteGATTDescriptor.h"
#include "modules/bluetooth/BluetoothRemoteGATTService.h"
#include "platform/heap/Handle.h"
#include "platform/heap/Heap.h"
@@ -51,6 +52,18 @@ class BluetoothAttributeInstanceMap final
// |characteristicInstanceId| is in the map.
bool containsCharacteristic(const String& characteristicInstanceId);
+ // Constructs a new BluetoothRemoteGATTDescriptor object if there was no
+ // descriptor with the same instance id and adds it to the map.
+ // Otherwise returns the BluetoothRemoteGATTDescriptor object already in
+ // the map.
+ BluetoothRemoteGATTDescriptor* getOrCreateBluetoothRemoteGATTDescriptor(
+ mojom::blink::WebBluetoothRemoteGATTDescriptorPtr,
+ BluetoothRemoteGATTCharacteristic*);
+
+ // Returns true if a BluetoothRemoteGATTDescriptor with
+ // |descriptorInstanceId| is in the map.
+ bool containsDescriptor(const String& descriptorInstanceId);
+
// Removes all Attributes from the map.
// TODO(crbug.com/654950): Remove descriptors when implemented.
void Clear();
@@ -65,6 +78,9 @@ class BluetoothAttributeInstanceMap final
// Map of characteristic instance ids to objects.
HeapHashMap<String, Member<BluetoothRemoteGATTCharacteristic>>
m_characteristicIdToObject;
+ // Map of descriptor instance ids to objects.
+ HeapHashMap<String, Member<BluetoothRemoteGATTDescriptor>>
+ m_descriptorIdToObject;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698