Index: components/arc/bluetooth/arc_bluetooth_bridge.h |
diff --git a/components/arc/bluetooth/arc_bluetooth_bridge.h b/components/arc/bluetooth/arc_bluetooth_bridge.h |
index fd98791b1995e9c1c65c4eb937b3297d873d626f..a5a2280e5241272fc7821f93bcc45f16ef0934e6 100644 |
--- a/components/arc/bluetooth/arc_bluetooth_bridge.h |
+++ b/components/arc/bluetooth/arc_bluetooth_bridge.h |
@@ -291,11 +291,11 @@ class ArcBluetoothBridge |
bool connected) const; |
void OnGattConnected( |
mojom::BluetoothAddressPtr addr, |
- std::unique_ptr<device::BluetoothGattConnection> connection) const; |
+ std::unique_ptr<device::BluetoothGattConnection> connection); |
void OnGattConnectError( |
mojom::BluetoothAddressPtr addr, |
device::BluetoothDevice::ConnectErrorCode error_code) const; |
- void OnGattDisconnected(mojom::BluetoothAddressPtr addr) const; |
+ void OnGattDisconnected(mojom::BluetoothAddressPtr addr); |
void OnStartLEListenDone(const StartLEListenCallback& callback, |
scoped_refptr<device::BluetoothAdvertisement> adv); |
@@ -385,6 +385,12 @@ class ArcBluetoothBridge |
int32_t gatt_server_attribute_next_handle_ = 0; |
// Keeps track of all devices which initiated a GATT connection to us. |
std::unordered_set<std::string> gatt_connection_cache_; |
+ // Map of device address to GATT connection objects for connections we |
+ // have made. We need to hang on to these as long as the connection is |
+ // active since their destructors will drop the connections otherwise. |
+ std::unordered_map<std::string, |
+ std::unique_ptr<device::BluetoothGattConnection>> |
+ gatt_connections_; |
// Timer to turn adapter discoverable off. |
base::OneShotTimer discoverable_off_timer_; |