app: delete the unused Config.ClassFinder method.
Change-Id: I8eea69f3ac6406fd58a9338f3aa358fead1afc0e Reviewed-on: https://go-review.googlesource.com/11473 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
This commit is contained in:
parent
0dbccd26eb
commit
e47fb7683e
|
@ -37,19 +37,6 @@ static jmethodID find_method(JNIEnv *env, jclass clazz, const char *name, const
|
|||
return m;
|
||||
}
|
||||
|
||||
static jclass app_class_loader;
|
||||
static jmethodID app_find_class_fn;
|
||||
|
||||
// app_find_class finds the given class using the class loader cached
|
||||
// during JNI_OnLoad. This allows the bind/java package and other
|
||||
// part of JNI to dynamically load java classes from non-Java threads.
|
||||
//
|
||||
// http://developer.android.com/training/articles/perf-jni.html#faq_FindClass
|
||||
jclass app_find_class(JNIEnv* env, const char* name) {
|
||||
jstring classname = (*env)->NewStringUTF(env, name);
|
||||
return (*env)->CallObjectMethod(env, app_class_loader, app_find_class_fn, classname);
|
||||
}
|
||||
|
||||
jint JNI_OnLoad(JavaVM* vm, void* reserved) {
|
||||
JNIEnv* env;
|
||||
if ((*vm)->GetEnv(vm, (void**)&env, JNI_VERSION_1_6) != JNI_OK) {
|
||||
|
@ -60,18 +47,6 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved) {
|
|||
current_ctx = NULL;
|
||||
current_native_activity = NULL;
|
||||
|
||||
// cache the class loader for use in JNI threads.
|
||||
jclass a_clazz = (*env)->FindClass(env, "go/Go");
|
||||
jclass clazz_clazz = (*env)->GetObjectClass(env, a_clazz);
|
||||
jclass class_loader_clazz = (*env)->FindClass(env, "java/lang/ClassLoader");
|
||||
jmethodID get_class_loader = (*env)->GetMethodID(env, clazz_clazz, "getClassLoader",
|
||||
"()Ljava/lang/ClassLoader;");
|
||||
jclass loader = (*env)->CallObjectMethod(env, a_clazz, get_class_loader);
|
||||
app_class_loader = (*env)->NewGlobalRef(env, loader);
|
||||
|
||||
app_find_class_fn = (*env)->GetMethodID(env, class_loader_clazz, "findClass",
|
||||
"(Ljava/lang/String;)Ljava/lang/Class;");
|
||||
|
||||
return JNI_VERSION_1_6;
|
||||
}
|
||||
|
||||
|
|
|
@ -205,12 +205,6 @@ func (Config) JavaVM() unsafe.Pointer {
|
|||
return unsafe.Pointer(C.current_vm)
|
||||
}
|
||||
|
||||
// ClassFinder returns a C function pointer for finding a given class using
|
||||
// the app class loader. (jclass) (*fn)(JNIEnv*, const char*).
|
||||
func (Config) ClassFinder() unsafe.Pointer {
|
||||
return unsafe.Pointer(C.app_find_class)
|
||||
}
|
||||
|
||||
func (Config) AndroidContext() unsafe.Pointer {
|
||||
return unsafe.Pointer(C.current_ctx)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue