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

Side by Side Diff: device/bluetooth/bluetooth_remote_gatt_descriptor_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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_remote_gatt_descriptor_android.h" 5 #include "device/bluetooth/bluetooth_remote_gatt_descriptor_android.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
11 #include "base/android/jni_string.h" 11 #include "base/android/jni_string.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/single_thread_task_runner.h" 15 #include "base/single_thread_task_runner.h"
16 #include "base/threading/thread_task_runner_handle.h" 16 #include "base/threading/thread_task_runner_handle.h"
17 #include "device/bluetooth/bluetooth_remote_gatt_service_android.h" 17 #include "device/bluetooth/bluetooth_remote_gatt_service_android.h"
18 #include "jni/ChromeBluetoothRemoteGattDescriptor_jni.h" 18 #include "jni/ChromeBluetoothRemoteGattDescriptor_jni.h"
19 19
20 using base::android::AttachCurrentThread; 20 using base::android::AttachCurrentThread;
21 using base::android::JavaParamRef; 21 using base::android::JavaParamRef;
22 using base::android::JavaRef;
22 23
23 namespace device { 24 namespace device {
24 25
25 // static 26 // static
26 std::unique_ptr<BluetoothRemoteGattDescriptorAndroid> 27 std::unique_ptr<BluetoothRemoteGattDescriptorAndroid>
27 BluetoothRemoteGattDescriptorAndroid::Create( 28 BluetoothRemoteGattDescriptorAndroid::Create(
28 const std::string& instance_id, 29 const std::string& instance_id,
29 jobject /* BluetoothGattDescriptorWrapper */ 30 const JavaRef<jobject>& /* BluetoothGattDescriptorWrapper */
30 bluetooth_gatt_descriptor_wrapper, 31 bluetooth_gatt_descriptor_wrapper,
31 jobject /* chromeBluetoothDevice */ 32 const JavaRef<jobject>& /* chromeBluetoothDevice */
32 chrome_bluetooth_device) { 33 chrome_bluetooth_device) {
33 std::unique_ptr<BluetoothRemoteGattDescriptorAndroid> descriptor( 34 std::unique_ptr<BluetoothRemoteGattDescriptorAndroid> descriptor(
34 new BluetoothRemoteGattDescriptorAndroid(instance_id)); 35 new BluetoothRemoteGattDescriptorAndroid(instance_id));
35 36
36 descriptor->j_descriptor_.Reset( 37 descriptor->j_descriptor_.Reset(
37 Java_ChromeBluetoothRemoteGattDescriptor_create( 38 Java_ChromeBluetoothRemoteGattDescriptor_create(
38 AttachCurrentThread(), reinterpret_cast<intptr_t>(descriptor.get()), 39 AttachCurrentThread(), reinterpret_cast<intptr_t>(descriptor.get()),
39 bluetooth_gatt_descriptor_wrapper, chrome_bluetooth_device)); 40 bluetooth_gatt_descriptor_wrapper, chrome_bluetooth_device));
40 41
41 return descriptor; 42 return descriptor;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 write_error_callback.Run( 181 write_error_callback.Run(
181 BluetoothRemoteGattServiceAndroid::GetGattErrorCode(status)); 182 BluetoothRemoteGattServiceAndroid::GetGattErrorCode(status));
182 } 183 }
183 } 184 }
184 185
185 BluetoothRemoteGattDescriptorAndroid::BluetoothRemoteGattDescriptorAndroid( 186 BluetoothRemoteGattDescriptorAndroid::BluetoothRemoteGattDescriptorAndroid(
186 const std::string& instance_id) 187 const std::string& instance_id)
187 : instance_id_(instance_id) {} 188 : instance_id_(instance_id) {}
188 189
189 } // namespace device 190 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_remote_gatt_descriptor_android.h ('k') | device/bluetooth/bluetooth_remote_gatt_service_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698