| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // Constructs a new BluetoothRemoteGATTCharacteristic object if there was no | 43 // Constructs a new BluetoothRemoteGATTCharacteristic object if there was no |
| 44 // characteristic with the same instance id and adds it to the map. | 44 // characteristic with the same instance id and adds it to the map. |
| 45 // Otherwise returns the BluetoothRemoteGATTCharacteristic object already in | 45 // Otherwise returns the BluetoothRemoteGATTCharacteristic object already in |
| 46 // the map. | 46 // the map. |
| 47 BluetoothRemoteGATTCharacteristic* | 47 BluetoothRemoteGATTCharacteristic* |
| 48 getOrCreateBluetoothRemoteGATTCharacteristic( | 48 getOrCreateBluetoothRemoteGATTCharacteristic( |
| 49 ExecutionContext*, | 49 ExecutionContext*, |
| 50 std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit>, | 50 std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit>, |
| 51 BluetoothRemoteGATTService*); | 51 BluetoothRemoteGATTService*); |
| 52 | 52 |
| 53 // Returns true if a BluetoothRemoteGATTCharacteristic with |
| 54 // |characteristicInstanceId| is in the map. |
| 55 bool containsCharacteristic(const String& characteristicInstanceId); |
| 56 |
| 53 // Removes all Attributes from the map. | 57 // Removes all Attributes from the map. |
| 54 // TODO(crbug.com/654950): Remove characteristics and descriptors when | 58 // TODO(crbug.com/654950): Remove descriptors when implemented. |
| 55 // implemented. | |
| 56 void Clear(); | 59 void Clear(); |
| 57 | 60 |
| 58 DECLARE_VIRTUAL_TRACE(); | 61 DECLARE_VIRTUAL_TRACE(); |
| 59 | 62 |
| 60 private: | 63 private: |
| 61 // BluetoothDevice that owns this map. | 64 // BluetoothDevice that owns this map. |
| 62 Member<BluetoothDevice> m_device; | 65 Member<BluetoothDevice> m_device; |
| 63 // Map of service instance ids to objects. | 66 // Map of service instance ids to objects. |
| 64 HeapHashMap<String, Member<BluetoothRemoteGATTService>> m_serviceIdToObject; | 67 HeapHashMap<String, Member<BluetoothRemoteGATTService>> m_serviceIdToObject; |
| 65 // Map of characteristic instance ids to objects. | 68 // Map of characteristic instance ids to objects. |
| 66 HeapHashMap<String, Member<BluetoothRemoteGATTCharacteristic>> | 69 HeapHashMap<String, Member<BluetoothRemoteGATTCharacteristic>> |
| 67 m_characteristicIdToObject; | 70 m_characteristicIdToObject; |
| 68 }; | 71 }; |
| 69 | 72 |
| 70 } // namespace blink | 73 } // namespace blink |
| 71 | 74 |
| 72 #endif // BluetoothAttributeInstanceMap_h | 75 #endif // BluetoothAttributeInstanceMap_h |
| OLD | NEW |