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

Unified Diff: device/bluetooth/bluetooth_low_energy_device_mac.mm

Issue 2276213002: bluetooth: Fix mac crash when logging is enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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: device/bluetooth/bluetooth_low_energy_device_mac.mm
diff --git a/device/bluetooth/bluetooth_low_energy_device_mac.mm b/device/bluetooth/bluetooth_low_energy_device_mac.mm
index 2dfaeef16d010f9401021a97d34097b813be0348..e7380faccd623f055a7f60591e7a6f72680b58dc 100644
--- a/device/bluetooth/bluetooth_low_energy_device_mac.mm
+++ b/device/bluetooth/bluetooth_low_energy_device_mac.mm
@@ -353,8 +353,7 @@ BluetoothLowEnergyDeviceMac::GetBluetoothRemoteGattService(
return nullptr;
}
-void BluetoothLowEnergyDeviceMac::DidDisconnectPeripheral(
- BluetoothDevice::ConnectErrorCode error_code) {
+void BluetoothLowEnergyDeviceMac::DidDisconnectPeripheral(NSError* error) {
SetGattServicesDiscoveryComplete(false);
// Removing all services at once to ensure that calling GetGattService on
// removed service in GattServiceRemoved returns null.
@@ -362,10 +361,16 @@ void BluetoothLowEnergyDeviceMac::DidDisconnectPeripheral(
gatt_services_swapped.swap(gatt_services_);
gatt_services_swapped.clear();
device_uuids_.ClearServiceUUIDs();
+ // There are two cases in which this function will be called:
+ // 1. When the connection to the device breaks (either because
+ // we closed it or the device closed it).
+ // 2. When we cancel a pending connection request.
if (create_gatt_connection_error_callbacks_.empty()) {
- // TODO(http://crbug.com/585897): Need to pass the error.
+ // If there are no pending callbacks then the connection broke (#1).
DidDisconnectGatt();
- } else {
- DidFailToConnectGatt(error_code);
+ return;
}
+ // Else we canceled the connection request (#2).
+ // TODO(http://crbug.com/585897): Need to pass the error.
+ DidFailToConnectGatt(BluetoothDevice::ConnectErrorCode::ERROR_FAILED);
Jeffrey Yasskin 2016/08/24 23:28:13 I think I've failed to specify this (https://githu
ortuno 2016/08/25 16:39:56 That makes sense. We currently have no error for t
}

Powered by Google App Engine
This is Rietveld 408576698