[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

benm at google.com benm at google.com
Wed Apr 7 23:56:49 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit fed75016ef8fdca55338f8c4e26e085965315189
Author: benm at google.com <benm at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Nov 25 11:02:18 2009 +0000

    [Android] Upstream Android changes to WebCore/bridge/jni
    https://bugs.webkit.org/show_bug.cgi?id=31824
    
    Reviewed by Eric Seidel.
    
    No new tests required as no new functionality.
    
    * bridge/jni/jni_class.cpp:
    (JavaClass::JavaClass): Add calls to delete allocated references, to avoid potential leaks.
    * bridge/jni/jni_instance.cpp: Add an Android include path.
    * bridge/jni/jni_instance.h: Add getter/setter for JObjectWrapper::_instance and make the JavaInstance ctor and member variables protected. Both needed for the Android port, see bug for discussion.
    (JSC::Bindings::JObjectWrapper::instance): Added.
    (JSC::Bindings::JObjectWrapper::setInstance): Added.
    * bridge/jni/jni_runtime.cpp:
    (JavaMethod::JavaMethod): Delete an allocated reference to avoid a potential leak.
    * bridge/jni/jni_utility.h:
    (JSC::Bindings::callJNIMethodV): Delete an allocated reference to avoid a potential leak.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51379 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 70529b2..13363ba 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2009-11-24  Ben Murdoch  <benm at google.com>
+
+        Reviewed by Eric Seidel.
+
+        [Android] Upstream Android changes to WebCore/bridge/jni
+        https://bugs.webkit.org/show_bug.cgi?id=31824
+
+        No new tests required as no new functionality.
+
+        * bridge/jni/jni_class.cpp:
+        (JavaClass::JavaClass): Add calls to delete allocated references, to avoid potential leaks.
+        * bridge/jni/jni_instance.cpp: Add an Android include path.
+        * bridge/jni/jni_instance.h: Add getter/setter for JObjectWrapper::_instance and make the JavaInstance ctor and member variables protected. Both needed for the Android port, see bug for discussion.
+        (JSC::Bindings::JObjectWrapper::instance): Added.
+        (JSC::Bindings::JObjectWrapper::setInstance): Added.
+        * bridge/jni/jni_runtime.cpp:
+        (JavaMethod::JavaMethod): Delete an allocated reference to avoid a potential leak.
+        * bridge/jni/jni_utility.h:
+        (JSC::Bindings::callJNIMethodV): Delete an allocated reference to avoid a potential leak.
+
 2009-11-24  Zoltan Horvath  <zoltan at webkit.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebCore/bridge/jni/jni_class.cpp b/WebCore/bridge/jni/jni_class.cpp
index 012b047..6728e7b 100644
--- a/WebCore/bridge/jni/jni_class.cpp
+++ b/WebCore/bridge/jni/jni_class.cpp
@@ -85,6 +85,10 @@ JavaClass::JavaClass(jobject anInstance)
         methodList->append(aMethod);
         env->DeleteLocalRef(aJMethod);
     }    
+
+    env->DeleteLocalRef(fields);
+    env->DeleteLocalRef(methods);
+    env->DeleteLocalRef(aClass);
 }
 
 JavaClass::~JavaClass() {
diff --git a/WebCore/bridge/jni/jni_instance.cpp b/WebCore/bridge/jni/jni_instance.cpp
index 2ef0c1d..d0bcfcb 100644
--- a/WebCore/bridge/jni/jni_instance.cpp
+++ b/WebCore/bridge/jni/jni_instance.cpp
@@ -37,6 +37,10 @@
 #include <runtime/Error.h>
 #include <runtime/JSLock.h>
 
+#if PLATFORM(ANDROID)
+#include <assert.h>
+#endif
+
 #ifdef NDEBUG
 #define JS_LOG(formatAndArgs...) ((void)0)
 #else
diff --git a/WebCore/bridge/jni/jni_instance.h b/WebCore/bridge/jni/jni_instance.h
index 0dcab3e..049bfdb 100644
--- a/WebCore/bridge/jni/jni_instance.h
+++ b/WebCore/bridge/jni/jni_instance.h
@@ -47,6 +47,10 @@ friend class JavaField;
 friend class JavaInstance;
 friend class JavaMethod;
 
+public:
+    jobject instance() const { return _instance; }
+    void setInstance(jobject instance) { _instance = instance; }
+
 protected:
     JObjectWrapper(jobject instance);    
     ~JObjectWrapper();
@@ -89,12 +93,10 @@ public:
     JSValue booleanValue() const;
 
 protected:
+    JavaInstance(jobject instance, PassRefPtr<RootObject>);
     virtual void virtualBegin();
     virtual void virtualEnd();
 
-private:
-    JavaInstance(jobject instance, PassRefPtr<RootObject>);
-
     RefPtr<JObjectWrapper> _instance;
     mutable JavaClass *_class;
 };
diff --git a/WebCore/bridge/jni/jni_runtime.cpp b/WebCore/bridge/jni/jni_runtime.cpp
index cc48037..d7d0696 100644
--- a/WebCore/bridge/jni/jni_runtime.cpp
+++ b/WebCore/bridge/jni/jni_runtime.cpp
@@ -284,6 +284,7 @@ JavaMethod::JavaMethod (JNIEnv *env, jobject aMethod)
     jclass modifierClass = env->FindClass("java/lang/reflect/Modifier");
     int modifiers = callJNIMethod<jint>(aMethod, "getModifiers", "()I");
     _isStatic = (bool)callJNIStaticMethod<jboolean>(modifierClass, "isStatic", "(I)Z", modifiers);
+    env->DeleteLocalRef(modifierClass);
 }
 
 JavaMethod::~JavaMethod() 
diff --git a/WebCore/bridge/jni/jni_utility.h b/WebCore/bridge/jni/jni_utility.h
index c315b1f..940cdc9 100644
--- a/WebCore/bridge/jni/jni_utility.h
+++ b/WebCore/bridge/jni/jni_utility.h
@@ -216,6 +216,8 @@ static T callJNIMethodV(jobject obj, const char *name, const char *sig, va_list
             jmethodID mid = env->GetMethodID(cls, name, sig);
             if ( mid != NULL )
             {
+                // Avoids references to cls without popping the local frame.
+                env->DeleteLocalRef(cls);
                 return JNICaller<T>::callV(obj, mid, args);
             }
             else

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list