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

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

Issue 2466223002: Implement WebBluetooth getDescriptor[s] (Closed)
Patch Set: Rebase Created 4 years 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 edbb5b8fb8611a6542cd4ddcde985397395a62c6..5b41ca7322354b3f9582ce3db242b87f03ea9a79 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"
@@ -54,6 +55,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(
ortuno 2016/12/02 06:14:50 Nice!
+ std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit>,
+ 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();
@@ -68,6 +81,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