| Index: components/arc/bluetooth/arc_bluetooth_bridge.cc
|
| diff --git a/components/arc/bluetooth/arc_bluetooth_bridge.cc b/components/arc/bluetooth/arc_bluetooth_bridge.cc
|
| index 7962377ab2fdf7492cb26f5babe25d9a17959653..ce51ea578c69e0edf2040982614ed6497c1f25b9 100644
|
| --- a/components/arc/bluetooth/arc_bluetooth_bridge.cc
|
| +++ b/components/arc/bluetooth/arc_bluetooth_bridge.cc
|
| @@ -919,7 +919,9 @@ void ArcBluetoothBridge::OnGattConnectStateChanged(
|
|
|
| void ArcBluetoothBridge::OnGattConnected(
|
| mojom::BluetoothAddressPtr addr,
|
| - std::unique_ptr<BluetoothGattConnection> connection) const {
|
| + std::unique_ptr<BluetoothGattConnection> connection) {
|
| + DCHECK(CalledOnValidThread());
|
| + gatt_connections_[addr->To<std::string>()] = std::move(connection);
|
| OnGattConnectStateChanged(std::move(addr), true);
|
| }
|
|
|
| @@ -930,7 +932,16 @@ void ArcBluetoothBridge::OnGattConnectError(
|
| }
|
|
|
| void ArcBluetoothBridge::OnGattDisconnected(
|
| - mojom::BluetoothAddressPtr addr) const {
|
| + mojom::BluetoothAddressPtr addr) {
|
| + DCHECK(CalledOnValidThread());
|
| + auto it = gatt_connections_.find(addr->To<std::string>());
|
| + if (it == gatt_connections_.end()) {
|
| + LOG(WARNING) << "OnGattDisconnected called, "
|
| + << "but no gatt connection was found";
|
| + } else {
|
| + gatt_connections_.erase(it);
|
| + }
|
| +
|
| OnGattConnectStateChanged(std::move(addr), false);
|
| }
|
|
|
|
|