summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2009-11-17 13:39:58 +0000
committerSteve Block <steveblock@google.com>2009-11-17 14:57:09 +0000
commit8dcb4bb39afc3d3e0f58ecee412a420fe0290076 (patch)
tree381e066ad33b19f05dc66d3522c7dd4338e20397
parent1865b30642c7bb27315677df124eb2c4f14daea6 (diff)
downloadexternal_webkit-8dcb4bb39afc3d3e0f58ecee412a420fe0290076.zip
external_webkit-8dcb4bb39afc3d3e0f58ecee412a420fe0290076.tar.gz
external_webkit-8dcb4bb39afc3d3e0f58ecee412a420fe0290076.tar.bz2
Cleans up Android-specific changes to WebCore/bridge/jni ready for upstreaing to webkit.org.
Change-Id: I0778955bee95680a9924fdae2967158e4add81ba
-rw-r--r--WebCore/bridge/jni/jni_class.cpp3
-rw-r--r--WebCore/bridge/jni/jni_instance.cpp6
-rw-r--r--WebCore/bridge/jni/jni_runtime.cpp3
-rw-r--r--WebCore/bridge/jni/jni_utility.cpp4
-rw-r--r--WebCore/bridge/jni/jni_utility.h15
5 files changed, 24 insertions, 7 deletions
diff --git a/WebCore/bridge/jni/jni_class.cpp b/WebCore/bridge/jni/jni_class.cpp
index 0877e50..9c7f300 100644
--- a/WebCore/bridge/jni/jni_class.cpp
+++ b/WebCore/bridge/jni/jni_class.cpp
@@ -85,7 +85,8 @@ JavaClass::JavaClass(jobject anInstance)
methodList->append(aMethod);
env->DeleteLocalRef(aJMethod);
}
-#ifdef ANDROID_FIX
+#if PLATFORM(ANDROID)
+ // TODO : Upstream to webkit.org for all platforms.
env->DeleteLocalRef(fields);
env->DeleteLocalRef(methods);
env->DeleteLocalRef(aClass);
diff --git a/WebCore/bridge/jni/jni_instance.cpp b/WebCore/bridge/jni/jni_instance.cpp
index 0022196..e3b857d 100644
--- a/WebCore/bridge/jni/jni_instance.cpp
+++ b/WebCore/bridge/jni/jni_instance.cpp
@@ -26,12 +26,12 @@
#include "config.h"
#include "jni_instance.h"
-#ifdef ANDROID
+#if ENABLE(MAC_JAVA_BRIDGE)
+
+#if PLATFORM(ANDROID)
#include <assert.h>
#endif
-#if ENABLE(MAC_JAVA_BRIDGE)
-
#include "jni_class.h"
#include "jni_runtime.h"
#include "jni_utility.h"
diff --git a/WebCore/bridge/jni/jni_runtime.cpp b/WebCore/bridge/jni/jni_runtime.cpp
index 2bac17a..50fe351 100644
--- a/WebCore/bridge/jni/jni_runtime.cpp
+++ b/WebCore/bridge/jni/jni_runtime.cpp
@@ -284,7 +284,8 @@ 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);
-#ifdef ANDROID_FIX
+#if PLATFORM(ANDROID)
+ // TODO : Upstream to webkit.org for all platforms.
env->DeleteLocalRef(modifierClass);
#endif
}
diff --git a/WebCore/bridge/jni/jni_utility.cpp b/WebCore/bridge/jni/jni_utility.cpp
index e57e475..e1eb736 100644
--- a/WebCore/bridge/jni/jni_utility.cpp
+++ b/WebCore/bridge/jni/jni_utility.cpp
@@ -28,6 +28,7 @@
#if ENABLE(MAC_JAVA_BRIDGE)
+#if PLATFORM(ANDROID)
#if USE(JSC)
#include "jni_runtime.h"
#include "runtime_array.h"
@@ -35,6 +36,7 @@
#include <runtime/JSArray.h>
#include <runtime/JSLock.h>
#endif
+#endif
#include <dlfcn.h>
@@ -350,6 +352,7 @@ jvalue getJNIField( jobject obj, JNIType type, const char *name, const char *sig
return result;
}
+#if PLATFORM(ANDROID)
#if USE(JSC)
static jobject convertArrayInstanceToJavaArray(ExecState* exec, JSArray* jsArray, const char* javaClassName)
{
@@ -581,6 +584,7 @@ jvalue convertValueToJValue(ExecState* exec, JSValue value, JNIType _JNIType, co
return result;
}
#endif // USE(JSC)
+#endif // PLATFORM(ANDROID)
} // end of namespace Bindings
diff --git a/WebCore/bridge/jni/jni_utility.h b/WebCore/bridge/jni/jni_utility.h
index 959330d..e46dbc4 100644
--- a/WebCore/bridge/jni/jni_utility.h
+++ b/WebCore/bridge/jni/jni_utility.h
@@ -28,10 +28,12 @@
#if ENABLE(MAC_JAVA_BRIDGE)
+#include <JavaVM/jni.h>
+#if PLATFORM(ANDROID)
#if USE(JSC)
#include <runtime/JSValue.h>
#endif
-#include <JavaVM/jni.h>
+#endif
// The order of these items can not be modified as they are tightly
// bound with the JVM on Mac OSX. If new types need to be added, they
@@ -55,10 +57,12 @@ typedef enum {
namespace JSC {
+#if PLATFORM(ANDROID)
#if USE(JSC)
class ExecState;
class JSObject;
#endif
+#endif
namespace Bindings {
@@ -76,9 +80,11 @@ JNIType JNITypeFromClassName(const char *name);
JNIType JNITypeFromPrimitiveType(char type);
const char *signatureFromPrimitiveType(JNIType type);
+#if PLATFORM(ANDROID)
#if USE(JSC)
jvalue convertValueToJValue(ExecState*, JSValue, JNIType, const char* javaClassName);
#endif
+#endif
jvalue getJNIField(jobject obj, JNIType type, const char *name, const char *signature);
@@ -222,7 +228,9 @@ static T callJNIMethodV(jobject obj, const char *name, const char *sig, va_list
jmethodID mid = env->GetMethodID(cls, name, sig);
if ( mid != NULL )
{
-#ifdef ANDROID_FIX // Avoids references to cls without popping the local frame.
+#if PLATFORM(ANDROID)
+ // TODO : Upstream to webkit.org for all platforms.
+ // Avoids references to cls without popping the local frame.
env->DeleteLocalRef(cls);
#endif
return JNICaller<T>::callV(obj, mid, args);
@@ -285,9 +293,12 @@ T callJNIStaticMethod(jclass cls, const char* methodName, const char* methodSign
return result;
}
+
+#if PLATFORM(ANDROID)
#if USE(JSC)
bool dispatchJNICall(ExecState*, const void* targetAppletView, jobject obj, bool isStatic, JNIType returnType, jmethodID methodID, jvalue* args, jvalue& result, const char* callingURL, JSValue& exceptionDescription);
#endif
+#endif
} // namespace Bindings