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

Unified Diff: device/bluetooth/bluetooth_remote_gatt_service_android.cc

Issue 1411183003: bluetooth: android: Clean up BluetoothRemoteGattServiceAndroid. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bta-getid-
Patch Set: Created 5 years, 2 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_service_android.cc
diff --git a/device/bluetooth/bluetooth_remote_gatt_service_android.cc b/device/bluetooth/bluetooth_remote_gatt_service_android.cc
index 1f15629b8acc31d7b733aaef52b3c6206579ad3d..734ff89c6903de97a399b160c24ea9b14cfa5043 100644
--- a/device/bluetooth/bluetooth_remote_gatt_service_android.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_service_android.cc
@@ -19,20 +19,24 @@ namespace device {
BluetoothRemoteGattServiceAndroid* BluetoothRemoteGattServiceAndroid::Create(
BluetoothAdapterAndroid* adapter,
BluetoothDeviceAndroid* device,
- jobject bluetooth_remote_gatt_service_wrapper,
+ jobject bluetooth_gatt_service_wrapper,
const std::string& instanceId) {
BluetoothRemoteGattServiceAndroid* service =
new BluetoothRemoteGattServiceAndroid(adapter, device, instanceId);
- JNIEnv* env = base::android::AttachCurrentThread();
+ JNIEnv* env = AttachCurrentThread();
service->j_service_.Reset(Java_ChromeBluetoothRemoteGattService_create(
- env, reinterpret_cast<intptr_t>(service),
- bluetooth_remote_gatt_service_wrapper,
+ env, reinterpret_cast<intptr_t>(service), bluetooth_gatt_service_wrapper,
base::android::ConvertUTF8ToJavaString(env, instanceId).obj()));
return service;
}
+BluetoothRemoteGattServiceAndroid::~BluetoothRemoteGattServiceAndroid() {
+ Java_ChromeBluetoothRemoteGattService_onBluetoothRemoteGattServiceAndroidDestruction(
+ AttachCurrentThread(), j_service_.obj());
+}
+
// static
bool BluetoothRemoteGattServiceAndroid::RegisterJNI(JNIEnv* env) {
return RegisterNativesImpl(
@@ -136,11 +140,6 @@ BluetoothRemoteGattServiceAndroid::BluetoothRemoteGattServiceAndroid(
const std::string& instanceId)
: adapter_(adapter), device_(device), instanceId_(instanceId) {}
-BluetoothRemoteGattServiceAndroid::~BluetoothRemoteGattServiceAndroid() {
- Java_ChromeBluetoothRemoteGattService_onBluetoothRemoteGattServiceAndroidDestruction(
- AttachCurrentThread(), j_service_.obj());
-}
-
void BluetoothRemoteGattServiceAndroid::EnsureCharacteristicsCreated() const {
if (!characteristics_.empty())
return;

Powered by Google App Engine
This is Rietveld 408576698