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

Side by Side Diff: device/usb/usb_device_handle_android.cc

Issue 2146753002: Android: Remove unneeded RegisterNatives() calls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Android: Don't require RegisterNatives if there are none Created 4 years, 4 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/usb/usb_device_handle_android.h" 5 #include "device/usb/usb_device_handle_android.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "device/usb/usb_device.h" 9 #include "device/usb/usb_device.h"
10 #include "jni/ChromeUsbConnection_jni.h" 10 #include "jni/ChromeUsbConnection_jni.h"
11 11
12 namespace device { 12 namespace device {
13 13
14 // static 14 // static
15 bool UsbDeviceHandleAndroid::RegisterJNI(JNIEnv* env) {
16 return RegisterNativesImpl(env); // Generated in ChromeUsbConnection_jni.h
17 }
18
19 // static
20 scoped_refptr<UsbDeviceHandleAndroid> UsbDeviceHandleAndroid::Create( 15 scoped_refptr<UsbDeviceHandleAndroid> UsbDeviceHandleAndroid::Create(
21 JNIEnv* env, 16 JNIEnv* env,
22 scoped_refptr<UsbDevice> device, 17 scoped_refptr<UsbDevice> device,
23 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner, 18 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner,
24 const base::android::JavaRef<jobject>& usb_connection) { 19 const base::android::JavaRef<jobject>& usb_connection) {
25 ScopedJavaLocalRef<jobject> wrapper = 20 ScopedJavaLocalRef<jobject> wrapper =
26 Java_ChromeUsbConnection_create(env, usb_connection.obj()); 21 Java_ChromeUsbConnection_create(env, usb_connection.obj());
27 base::ScopedFD fd( 22 base::ScopedFD fd(
28 Java_ChromeUsbConnection_getFileDescriptor(env, wrapper.obj())); 23 Java_ChromeUsbConnection_getFileDescriptor(env, wrapper.obj()));
29 return make_scoped_refptr(new UsbDeviceHandleAndroid( 24 return make_scoped_refptr(new UsbDeviceHandleAndroid(
(...skipping 16 matching lines...) Expand all
46 FROM_HERE, base::Bind(&UsbDeviceHandleAndroid::CloseConnection, this)); 41 FROM_HERE, base::Bind(&UsbDeviceHandleAndroid::CloseConnection, this));
47 } 42 }
48 43
49 void UsbDeviceHandleAndroid::CloseConnection() { 44 void UsbDeviceHandleAndroid::CloseConnection() {
50 JNIEnv* env = base::android::AttachCurrentThread(); 45 JNIEnv* env = base::android::AttachCurrentThread();
51 Java_ChromeUsbConnection_close(env, j_object_.obj()); 46 Java_ChromeUsbConnection_close(env, j_object_.obj());
52 j_object_.Reset(); 47 j_object_.Reset();
53 } 48 }
54 49
55 } // namespace device 50 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698