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

Side by Side Diff: device/bluetooth/bluetooth_device_android.cc

Issue 1369463004: bluetooth: android: Disconnect GATT upon BluetoothDeviceAndroid object destruction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/bluetooth/bluetooth_device_android.h" 5 #include "device/bluetooth/bluetooth_device_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "device/bluetooth/bluetooth_adapter_android.h" 10 #include "device/bluetooth/bluetooth_adapter_android.h"
(...skipping 10 matching lines...) Expand all
21 BluetoothDeviceAndroid* device = new BluetoothDeviceAndroid(adapter); 21 BluetoothDeviceAndroid* device = new BluetoothDeviceAndroid(adapter);
22 22
23 device->j_device_.Reset(Java_ChromeBluetoothDevice_create( 23 device->j_device_.Reset(Java_ChromeBluetoothDevice_create(
24 AttachCurrentThread(), reinterpret_cast<intptr_t>(device), 24 AttachCurrentThread(), reinterpret_cast<intptr_t>(device),
25 bluetooth_device_wrapper)); 25 bluetooth_device_wrapper));
26 26
27 return device; 27 return device;
28 } 28 }
29 29
30 BluetoothDeviceAndroid::~BluetoothDeviceAndroid() { 30 BluetoothDeviceAndroid::~BluetoothDeviceAndroid() {
31 Java_ChromeBluetoothDevice_onBluetoothDeviceAndroidDestruction(
32 AttachCurrentThread(), j_device_.obj());
31 } 33 }
32 34
33 bool BluetoothDeviceAndroid::UpdateAdvertisedUUIDs(jobject advertised_uuids) { 35 bool BluetoothDeviceAndroid::UpdateAdvertisedUUIDs(jobject advertised_uuids) {
34 return Java_ChromeBluetoothDevice_updateAdvertisedUUIDs( 36 return Java_ChromeBluetoothDevice_updateAdvertisedUUIDs(
35 AttachCurrentThread(), j_device_.obj(), advertised_uuids); 37 AttachCurrentThread(), j_device_.obj(), advertised_uuids);
36 } 38 }
37 39
38 // static 40 // static
39 bool BluetoothDeviceAndroid::RegisterJNI(JNIEnv* env) { 41 bool BluetoothDeviceAndroid::RegisterJNI(JNIEnv* env) {
40 return RegisterNativesImpl(env); // Generated in ChromeBluetoothDevice_jni.h 42 return RegisterNativesImpl(env); // Generated in ChromeBluetoothDevice_jni.h
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 AttachCurrentThread(), j_device_.obj(), 234 AttachCurrentThread(), j_device_.obj(),
233 base::android::GetApplicationContext()); 235 base::android::GetApplicationContext());
234 } 236 }
235 237
236 void BluetoothDeviceAndroid::DisconnectGatt() { 238 void BluetoothDeviceAndroid::DisconnectGatt() {
237 Java_ChromeBluetoothDevice_disconnectGatt(AttachCurrentThread(), 239 Java_ChromeBluetoothDevice_disconnectGatt(AttachCurrentThread(),
238 j_device_.obj()); 240 j_device_.obj());
239 } 241 }
240 242
241 } // namespace device 243 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698