Index: device/bluetooth/bluetooth_device.cc |
diff --git a/device/bluetooth/bluetooth_device.cc b/device/bluetooth/bluetooth_device.cc |
index 05532cc2b071b831cbc744c2d107cf6c07da519f..c85af11c090b5233e6b40d010689d74e841ca17f 100644 |
--- a/device/bluetooth/bluetooth_device.cc |
+++ b/device/bluetooth/bluetooth_device.cc |
@@ -303,6 +303,10 @@ void BluetoothDevice::DidConnectGatt() { |
} |
void BluetoothDevice::DidFailToConnectGatt(ConnectErrorCode error) { |
+ // Connection request should only be made if there are no active |
+ // connections. |
+ DCHECK(gatt_connections_.empty()); |
+ |
for (const auto& error_callback : create_gatt_connection_error_callbacks_) |
error_callback.Run(error); |
create_gatt_connection_success_callbacks_.clear(); |
@@ -311,13 +315,8 @@ void BluetoothDevice::DidFailToConnectGatt(ConnectErrorCode error) { |
void BluetoothDevice::DidDisconnectGatt() { |
// Pending calls to connect GATT are not expected, if they were then |
- // DidFailToConnectGatt should be called. But in case callbacks exist |
- // flush them to ensure a consistent state. |
- if (create_gatt_connection_error_callbacks_.size() > 0) { |
- VLOG(1) << "Unexpected / unexplained DidDisconnectGatt call while " |
- "create_gatt_connection_error_callbacks_ are pending."; |
- } |
- DidFailToConnectGatt(ERROR_FAILED); |
+ // DidFailToConnectGatt should have been called. |
+ DCHECK(create_gatt_connection_error_callbacks_.empty()); |
// Invalidate all BluetoothGattConnection objects. |
for (BluetoothGattConnection* connection : gatt_connections_) { |