summaryrefslogtreecommitdiffstats
path: root/WebKit/android/jni/WebCoreJni.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/android/jni/WebCoreJni.cpp')
-rw-r--r--WebKit/android/jni/WebCoreJni.cpp35
1 files changed, 2 insertions, 33 deletions
diff --git a/WebKit/android/jni/WebCoreJni.cpp b/WebKit/android/jni/WebCoreJni.cpp
index aa3e2c7..ef33cc0 100644
--- a/WebKit/android/jni/WebCoreJni.cpp
+++ b/WebKit/android/jni/WebCoreJni.cpp
@@ -35,25 +35,10 @@
namespace android {
-// Class, constructor, and get method on WeakReference
-jclass gWeakRefClass;
-jmethodID gWeakRefInit;
-jmethodID gWeakRefGet;
-
-jobject adoptGlobalRef(JNIEnv* env, jobject obj)
-{
- // Create a WeakReference object
- jobject ref = env->NewObject(gWeakRefClass, gWeakRefInit, obj);
- // Increment the ref count of the WeakReference
- ref = env->NewGlobalRef(ref);
- return ref;
-}
-
AutoJObject getRealObject(JNIEnv* env, jobject obj)
{
- jobject real = env->CallObjectMethod(obj, gWeakRefGet);
- if (!real)
- LOGE("The real object has been deleted");
+ jobject real = env->NewLocalRef(obj);
+ LOG_ASSERT(real, "The real object has been deleted!");
return AutoJObject(env, real);
}
@@ -86,20 +71,4 @@ WebCore::String to_string(JNIEnv* env, jstring str)
return ret;
}
-int register_webcorejni(JNIEnv* env) {
- // Instantiate the WeakReference fields.
- jclass weakRef = env->FindClass("java/lang/ref/WeakReference");
- LOG_ASSERT(weakRef, "Could not find WeakReference");
- android::gWeakRefClass = (jclass)env->NewGlobalRef(weakRef);
- android::gWeakRefInit = env->GetMethodID(android::gWeakRefClass,
- "<init>", "(Ljava/lang/Object;)V");
- LOG_ASSERT(android::gWeakRefInit,
- "Could not find constructor for WeakReference");
- android::gWeakRefGet = env->GetMethodID(android::gWeakRefClass, "get",
- "()Ljava/lang/Object;");
- LOG_ASSERT(android::gWeakRefInit,
- "Could not find get method for WeakReference");
- return JNI_OK;
-}
-
}