OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BluetoothAttributeInstanceMap_h | 5 #ifndef BluetoothAttributeInstanceMap_h |
6 #define BluetoothAttributeInstanceMap_h | 6 #define BluetoothAttributeInstanceMap_h |
7 | 7 |
8 #include "modules/bluetooth/BluetoothRemoteGATTCharacteristic.h" | 8 #include "modules/bluetooth/BluetoothRemoteGATTCharacteristic.h" |
9 #include "modules/bluetooth/BluetoothRemoteGATTService.h" | 9 #include "modules/bluetooth/BluetoothRemoteGATTService.h" |
10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 // Returns true if a BluetoothRemoteGATTService with |serviceInstanceId| | 37 // Returns true if a BluetoothRemoteGATTService with |serviceInstanceId| |
38 // is in the map. | 38 // is in the map. |
39 bool containsService(const String& serviceInstanceId); | 39 bool containsService(const String& serviceInstanceId); |
40 | 40 |
41 // Constructs a new BluetoothRemoteGATTCharacteristic object if there was no | 41 // Constructs a new BluetoothRemoteGATTCharacteristic object if there was no |
42 // characteristic with the same instance id and adds it to the map. | 42 // characteristic with the same instance id and adds it to the map. |
43 // Otherwise returns the BluetoothRemoteGATTCharacteristic object already in | 43 // Otherwise returns the BluetoothRemoteGATTCharacteristic object already in |
44 // the map. | 44 // the map. |
45 BluetoothRemoteGATTCharacteristic* getOrCreateRemoteGATTCharacteristic( | 45 BluetoothRemoteGATTCharacteristic* getOrCreateRemoteGATTCharacteristic( |
46 ExecutionContext*, | 46 ExecutionContext*, |
47 const String& serviceInstanceId, | |
48 mojom::blink::WebBluetoothRemoteGATTCharacteristicPtr, | 47 mojom::blink::WebBluetoothRemoteGATTCharacteristicPtr, |
49 BluetoothRemoteGATTService*); | 48 BluetoothRemoteGATTService*); |
50 | 49 |
51 // Returns true if a BluetoothRemoteGATTCharacteristic with | 50 // Returns true if a BluetoothRemoteGATTCharacteristic with |
52 // |characteristicInstanceId| is in the map. | 51 // |characteristicInstanceId| is in the map. |
53 bool containsCharacteristic(const String& characteristicInstanceId); | 52 bool containsCharacteristic(const String& characteristicInstanceId); |
54 | 53 |
55 // Removes all Attributes from the map. | 54 // Removes all Attributes from the map. |
56 // TODO(crbug.com/654950): Remove descriptors when implemented. | 55 // TODO(crbug.com/654950): Remove descriptors when implemented. |
57 void Clear(); | 56 void Clear(); |
58 | 57 |
59 DECLARE_VIRTUAL_TRACE(); | 58 DECLARE_VIRTUAL_TRACE(); |
60 | 59 |
61 private: | 60 private: |
62 // BluetoothDevice that owns this map. | 61 // BluetoothDevice that owns this map. |
63 Member<BluetoothDevice> m_device; | 62 Member<BluetoothDevice> m_device; |
64 // Map of service instance ids to objects. | 63 // Map of service instance ids to objects. |
65 HeapHashMap<String, Member<BluetoothRemoteGATTService>> m_serviceIdToObject; | 64 HeapHashMap<String, Member<BluetoothRemoteGATTService>> m_serviceIdToObject; |
66 // Map of characteristic instance ids to objects. | 65 // Map of characteristic instance ids to objects. |
67 HeapHashMap<String, Member<BluetoothRemoteGATTCharacteristic>> | 66 HeapHashMap<String, Member<BluetoothRemoteGATTCharacteristic>> |
68 m_characteristicIdToObject; | 67 m_characteristicIdToObject; |
69 }; | 68 }; |
70 | 69 |
71 } // namespace blink | 70 } // namespace blink |
72 | 71 |
73 #endif // BluetoothAttributeInstanceMap_h | 72 #endif // BluetoothAttributeInstanceMap_h |
OLD | NEW |