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

Unified Diff: components/arc/bluetooth/arc_bluetooth_bridge.cc

Issue 2321693002: arc/bluetooth: Save BluetoothGattConnection objects (Closed)
Patch Set: Created 4 years, 3 months 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: 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 937d601ffeb244d5d63045af3548ca9f4edfd228..0eca07d76b151c9b28c031cd49d9c096a91918d1 100644
--- a/components/arc/bluetooth/arc_bluetooth_bridge.cc
+++ b/components/arc/bluetooth/arc_bluetooth_bridge.cc
@@ -943,7 +943,8 @@ void ArcBluetoothBridge::OnGattConnectStateChanged(
void ArcBluetoothBridge::OnGattConnected(
mojom::BluetoothAddressPtr addr,
- std::unique_ptr<BluetoothGattConnection> connection) const {
+ std::unique_ptr<BluetoothGattConnection> connection) {
+ gatt_connections_.emplace(addr->To<std::string>(), std::move(connection));
Luis Héctor Chávez 2016/09/07 19:54:14 nit: DCHECK(CalledOnValidThread());
OnGattConnectStateChanged(std::move(addr), true);
}
@@ -954,7 +955,14 @@ void ArcBluetoothBridge::OnGattConnectError(
}
void ArcBluetoothBridge::OnGattDisconnected(
- mojom::BluetoothAddressPtr addr) const {
+ mojom::BluetoothAddressPtr addr) {
+ auto it = gatt_connections_.find(addr->To<std::string>());
Luis Héctor Chávez 2016/09/07 19:54:14 nit: DCHECK(CalledOnValidThread());
+ 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);
}

Powered by Google App Engine
This is Rietveld 408576698