Index: device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc |
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc b/device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc |
index 8d5868b5caa368efe8431210acc00a5cf8a39c3b..3e0699e7aa3a8e159d5ce99b90e11f16942218eb 100644 |
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc |
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc |
@@ -144,7 +144,10 @@ void BluetoothRemoteGattCharacteristicAndroid::ReadRemoteCharacteristic( |
const ValueCallback& callback, |
const ErrorCallback& error_callback) { |
if (read_pending_ || write_pending_) { |
- error_callback.Run(BluetoothGattService::GATT_ERROR_IN_PROGRESS); |
+ base::MessageLoop::current()->PostTask( |
+ FROM_HERE, base::Bind(error_callback, |
+ BluetoothGattService::GATT_ERROR_IN_PROGRESS)); |
+ return; |
} |
if (!Java_ChromeBluetoothRemoteGattCharacteristic_readRemoteCharacteristic( |
@@ -166,7 +169,10 @@ void BluetoothRemoteGattCharacteristicAndroid::WriteRemoteCharacteristic( |
const base::Closure& callback, |
const ErrorCallback& error_callback) { |
if (read_pending_ || write_pending_) { |
- error_callback.Run(BluetoothGattService::GATT_ERROR_IN_PROGRESS); |
+ base::MessageLoop::current()->PostTask( |
+ FROM_HERE, base::Bind(error_callback, |
+ BluetoothGattService::GATT_ERROR_IN_PROGRESS)); |
+ return; |
} |
JNIEnv* env = AttachCurrentThread(); |