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

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

Issue 2319213005: 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
« no previous file with comments | « components/arc/bluetooth/arc_bluetooth_bridge.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 50963c920acb590c87964d8ff3cc9fbea4a1d6d3..5805d487ce396566b70f74ec46023dad047c5aa7 100644
--- a/components/arc/bluetooth/arc_bluetooth_bridge.cc
+++ b/components/arc/bluetooth/arc_bluetooth_bridge.cc
@@ -943,7 +943,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);
}
@@ -954,7 +956,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);
}
« no previous file with comments | « components/arc/bluetooth/arc_bluetooth_bridge.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698