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 8195119eeef79d0e4eaee02e47e299cd4796a2d3..2e3b81d9881124318b6f1131cdf3b067b1c0449a 100644 |
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc |
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc |
@@ -10,8 +10,10 @@ |
#include "base/android/jni_array.h" |
#include "base/android/jni_string.h" |
#include "base/bind.h" |
+#include "base/location.h" |
#include "base/logging.h" |
-#include "base/message_loop/message_loop.h" |
+#include "base/single_thread_task_runner.h" |
+#include "base/threading/thread_task_runner_handle.h" |
#include "device/bluetooth/bluetooth_adapter_android.h" |
#include "device/bluetooth/bluetooth_gatt_notify_session_android.h" |
#include "device/bluetooth/bluetooth_remote_gatt_descriptor_android.h" |
@@ -140,7 +142,7 @@ void BluetoothRemoteGattCharacteristicAndroid::StartNotifySession( |
if (!hasNotify && !hasIndicate) { |
LOG(ERROR) << "Characteristic needs NOTIFY or INDICATE"; |
- base::MessageLoop::current()->PostTask( |
+ base::ThreadTaskRunnerHandle::Get()->PostTask( |
FROM_HERE, |
base::Bind(error_callback, |
BluetoothRemoteGattService::GATT_ERROR_NOT_SUPPORTED)); |
@@ -154,7 +156,7 @@ void BluetoothRemoteGattCharacteristicAndroid::StartNotifySession( |
if (ccc_descriptor.size() != 1u) { |
LOG(ERROR) << "Found " << ccc_descriptor.size() |
<< " client characteristic configuration descriptors."; |
- base::MessageLoop::current()->PostTask( |
+ base::ThreadTaskRunnerHandle::Get()->PostTask( |
FROM_HERE, |
base::Bind(error_callback, |
(ccc_descriptor.size() == 0) |
@@ -166,7 +168,7 @@ void BluetoothRemoteGattCharacteristicAndroid::StartNotifySession( |
if (!Java_ChromeBluetoothRemoteGattCharacteristic_setCharacteristicNotification( |
AttachCurrentThread(), j_characteristic_.obj(), true)) { |
LOG(ERROR) << "Error enabling characteristic notification"; |
- base::MessageLoop::current()->PostTask( |
+ base::ThreadTaskRunnerHandle::Get()->PostTask( |
FROM_HERE, base::Bind(error_callback, |
BluetoothRemoteGattService::GATT_ERROR_FAILED)); |
return; |
@@ -190,7 +192,7 @@ void BluetoothRemoteGattCharacteristicAndroid::ReadRemoteCharacteristic( |
const ValueCallback& callback, |
const ErrorCallback& error_callback) { |
if (read_pending_ || write_pending_) { |
- base::MessageLoop::current()->PostTask( |
+ base::ThreadTaskRunnerHandle::Get()->PostTask( |
FROM_HERE, |
base::Bind(error_callback, |
BluetoothRemoteGattService::GATT_ERROR_IN_PROGRESS)); |
@@ -199,7 +201,7 @@ void BluetoothRemoteGattCharacteristicAndroid::ReadRemoteCharacteristic( |
if (!Java_ChromeBluetoothRemoteGattCharacteristic_readRemoteCharacteristic( |
AttachCurrentThread(), j_characteristic_.obj())) { |
- base::MessageLoop::current()->PostTask( |
+ base::ThreadTaskRunnerHandle::Get()->PostTask( |
FROM_HERE, base::Bind(error_callback, |
BluetoothRemoteGattService::GATT_ERROR_FAILED)); |
return; |
@@ -215,7 +217,7 @@ void BluetoothRemoteGattCharacteristicAndroid::WriteRemoteCharacteristic( |
const base::Closure& callback, |
const ErrorCallback& error_callback) { |
if (read_pending_ || write_pending_) { |
- base::MessageLoop::current()->PostTask( |
+ base::ThreadTaskRunnerHandle::Get()->PostTask( |
FROM_HERE, |
base::Bind(error_callback, |
BluetoothRemoteGattService::GATT_ERROR_IN_PROGRESS)); |
@@ -226,7 +228,7 @@ void BluetoothRemoteGattCharacteristicAndroid::WriteRemoteCharacteristic( |
if (!Java_ChromeBluetoothRemoteGattCharacteristic_writeRemoteCharacteristic( |
env, j_characteristic_.obj(), |
base::android::ToJavaByteArray(env, new_value).obj())) { |
- base::MessageLoop::current()->PostTask( |
+ base::ThreadTaskRunnerHandle::Get()->PostTask( |
FROM_HERE, base::Bind(error_callback, |
BluetoothRemoteGattService::GATT_ERROR_FAILED)); |
return; |