Index: device/bluetooth/bluetooth_device_chromeos.cc |
diff --git a/device/bluetooth/bluetooth_device_chromeos.cc b/device/bluetooth/bluetooth_device_chromeos.cc |
index d40e09266fe68e73f6dfb7d9ae3524e1034cd0c8..e26cd90d9aaf6c90eff393bf8cf8b42595632d96 100644 |
--- a/device/bluetooth/bluetooth_device_chromeos.cc |
+++ b/device/bluetooth/bluetooth_device_chromeos.cc |
@@ -118,6 +118,10 @@ void BluetoothDeviceChromeOS::Connect( |
// This is safe because Connect() and its callbacks are called in the same |
// thread. |
connecting_calls_++; |
+ if (connecting_calls_ != 0 && !connecting_) { |
keybuk
2013/04/18 00:52:24
How can connecting calls be zero if you just incre
deymo
2013/04/18 01:38:40
Probably it can't. I just translated this:
if (inv
|
+ connecting_ = true; |
+ adapter_->DeviceChanged(this); |
+ } |
connecting_ = !!connecting_calls_; |
// Set the decrement to be issued when either callback is called. |
base::Closure wrapped_callback = base::Bind( |
@@ -521,18 +525,22 @@ void BluetoothDeviceChromeOS::OnGetServiceRecordsError( |
void BluetoothDeviceChromeOS::OnConnectCallbackCalled( |
const base::Closure& callback) { |
// Update the connecting status. |
+ bool prev_connecting = !!connecting_calls_; |
connecting_calls_--; |
connecting_ = !!connecting_calls_; |
callback.Run(); |
+ if (prev_connecting != connecting_) adapter_->DeviceChanged(this); |
} |
void BluetoothDeviceChromeOS::OnConnectErrorCallbackCalled( |
const ConnectErrorCallback& error_callback, |
enum ConnectErrorCode error_code) { |
// Update the connecting status. |
+ bool prev_connecting = !!connecting_calls_; |
connecting_calls_--; |
connecting_ = !!connecting_calls_; |
error_callback.Run(error_code); |
+ if (prev_connecting != connecting_) adapter_->DeviceChanged(this); |
} |
void BluetoothDeviceChromeOS::ConnectApplications( |