Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(927)

Unified Diff: device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc

Issue 2313413002: Pass JavaRef to Java methods in device/bluetooth. (Closed)
Patch Set: Switch comments to a different form that clang-format will fit in 80 chars Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 594303773ae06602ff55644b2728cd34a7d0f7cc..ecab337479bf4658154ba0e97f6fd2e909b9422d 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc
@@ -21,6 +21,7 @@
using base::android::AttachCurrentThread;
using base::android::JavaParamRef;
+using base::android::JavaRef;
namespace device {
@@ -30,9 +31,10 @@ BluetoothRemoteGattCharacteristicAndroid::Create(
BluetoothAdapterAndroid* adapter,
BluetoothRemoteGattServiceAndroid* service,
const std::string& instance_id,
- jobject /* BluetoothGattCharacteristicWrapper */
+ const JavaRef<jobject>& /* BluetoothGattCharacteristicWrapper */
bluetooth_gatt_characteristic_wrapper,
- jobject /* ChromeBluetoothDevice */ chrome_bluetooth_device) {
+ const JavaRef<
+ jobject>& /* ChromeBluetoothDevice */ chrome_bluetooth_device) {
std::unique_ptr<BluetoothRemoteGattCharacteristicAndroid> characteristic(
new BluetoothRemoteGattCharacteristicAndroid(adapter, service,
instance_id));
@@ -243,7 +245,7 @@ void BluetoothRemoteGattCharacteristicAndroid::SubscribeToNotifications(
const base::Closure& callback,
const ErrorCallback& error_callback) {
if (!Java_ChromeBluetoothRemoteGattCharacteristic_setCharacteristicNotification(
- AttachCurrentThread(), j_characteristic_.obj(), true)) {
+ AttachCurrentThread(), j_characteristic_, true)) {
LOG(ERROR) << "Error enabling characteristic notification";
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(error_callback,
@@ -263,7 +265,7 @@ void BluetoothRemoteGattCharacteristicAndroid::UnsubscribeFromNotifications(
const base::Closure& callback,
const ErrorCallback& error_callback) {
if (!Java_ChromeBluetoothRemoteGattCharacteristic_setCharacteristicNotification(
- AttachCurrentThread(), j_characteristic_.obj(), false)) {
+ AttachCurrentThread(), j_characteristic_, false)) {
LOG(ERROR) << "Error disabling characteristic notification";
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,

Powered by Google App Engine
This is Rietveld 408576698