Chromium Code Reviews| 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 e335e5fb916f389b6e88d7b9bd285fcc3e72f114..77201add7b1abbb8810c6844f6f2912978d215dd 100644 |
| --- a/device/bluetooth/bluetooth_low_energy_device_mac.mm |
| +++ b/device/bluetooth/bluetooth_low_energy_device_mac.mm |
| @@ -391,18 +391,25 @@ BluetoothLowEnergyDeviceMac::GetBluetoothRemoteGattService( |
| return nullptr; |
| } |
| +void BluetoothLowEnergyDeviceMac::DidDisconnectPeripheral() { |
| + RemoveAllServices(); |
| + DCHECK(create_gatt_connection_error_callbacks_.empty()); |
| + DidDisconnectGatt(); |
| +} |
| + |
| void BluetoothLowEnergyDeviceMac::DidDisconnectPeripheral( |
|
ortuno
2016/08/09 19:14:56
I wonder if we really need this function now. Once
jlebel
2016/08/10 08:42:19
There is no point to call BluetoothDevice::DidDisc
ortuno
2016/08/10 16:49:09
I'm saying that you don't really need this error v
|
| BluetoothDevice::ConnectErrorCode error_code) { |
| + RemoveAllServices(); |
| + DCHECK(create_gatt_connection_error_callbacks_.empty()); |
| + // TODO(http://crbug.com/585897): Need to pass the error. |
| + DidDisconnectGatt(); |
| +} |
| + |
| +void BluetoothLowEnergyDeviceMac::RemoveAllServices() { |
| SetGattServicesDiscoveryComplete(false); |
| // Removing all services at once to ensure that calling GetGattService on |
| // removed service in GattServiceRemoved returns null. |
| GattServiceMap gatt_services_swapped; |
| gatt_services_swapped.swap(gatt_services_); |
| gatt_services_swapped.clear(); |
| - if (create_gatt_connection_error_callbacks_.empty()) { |
| - // TODO(http://crbug.com/585897): Need to pass the error. |
| - DidDisconnectGatt(); |
| - } else { |
| - DidFailToConnectGatt(error_code); |
| - } |
| } |