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

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: address ortuno 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
« no previous file with comments | « device/bluetooth/bluetooth_remote_gatt_service_android.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..ed503d49bed3fbd2557f3f5d1f59e65b7fac912b 100644
--- a/device/bluetooth/bluetooth_remote_gatt_service_android.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_service_android.cc
@@ -16,23 +16,29 @@ using base::android::AttachCurrentThread;
namespace device {
// static
-BluetoothRemoteGattServiceAndroid* BluetoothRemoteGattServiceAndroid::Create(
+scoped_ptr<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);
+ scoped_ptr<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.get()),
+ 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 +142,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;
« no previous file with comments | « device/bluetooth/bluetooth_remote_gatt_service_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698