Title: [116405] trunk/Source/WebCore
Revision
116405
Author
[email protected]
Date
2012-05-08 02:00:08 -0700 (Tue, 08 May 2012)

Log Message

OS(ANDROID) JNI AttachCurrentThread take JNIEnv** as a parameter, not void**
https://bugs.webkit.org/show_bug.cgi?id=85869

Reviewed by Eric Seidel.

According to
http://docs.oracle.com/javase/1.5.0/docs/guide/jni/spec/invocation.html,
AttachCurrentThread takes a JNIEnv** rather than a void**.  Apparently,
most implementations actually take a void**.  The OS(ANDROID)
implementation, however, actually takes an JNIEnv**.  This patch
introduces a typedef to give each implementation what it desires.

* bridge/jni/JNIUtility.cpp:
(JSC::Bindings::getJNIEnv):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (116404 => 116405)


--- trunk/Source/WebCore/ChangeLog	2012-05-08 08:59:53 UTC (rev 116404)
+++ trunk/Source/WebCore/ChangeLog	2012-05-08 09:00:08 UTC (rev 116405)
@@ -1,3 +1,20 @@
+2012-05-08  Adam Barth  <[email protected]>
+
+        OS(ANDROID) JNI AttachCurrentThread take JNIEnv** as a parameter, not void**
+        https://bugs.webkit.org/show_bug.cgi?id=85869
+
+        Reviewed by Eric Seidel.
+
+        According to
+        http://docs.oracle.com/javase/1.5.0/docs/guide/jni/spec/invocation.html,
+        AttachCurrentThread takes a JNIEnv** rather than a void**.  Apparently,
+        most implementations actually take a void**.  The OS(ANDROID)
+        implementation, however, actually takes an JNIEnv**.  This patch
+        introduces a typedef to give each implementation what it desires.
+
+        * bridge/jni/JNIUtility.cpp:
+        (JSC::Bindings::getJNIEnv):
+
 2012-05-08  Balazs Kelemen  <[email protected]>
 
         [Qt] X11 plugins need to be reworked for Qt5+WK1

Modified: trunk/Source/WebCore/bridge/jni/JNIUtility.cpp (116404 => 116405)


--- trunk/Source/WebCore/bridge/jni/JNIUtility.cpp	2012-05-08 08:59:53 UTC (rev 116404)
+++ trunk/Source/WebCore/bridge/jni/JNIUtility.cpp	2012-05-08 09:00:08 UTC (rev 116405)
@@ -82,11 +82,23 @@
     return jvm;
 }
 
+// JDK 1.0 mistakenly declared the first parameter to AttachCurrentThread as
+// void** rather than as JNIEnv**. This quirk appears to have been carried
+// forward in implementations of Java despite what the documentation says.
+// On OS(ANDROID), however, AttachCurrentThread appears to follow the
+// documentation and expects a JNIEnv** parameter. The following typedef should
+// give each implementation what it desires.
+#if OS(ANDROID)
+typedef JNIEnv* JNIEnvDummy;
+#else
+typedef void* JNIEnvDummy;
+#endif
+
 JNIEnv* getJNIEnv()
 {
     union {
         JNIEnv* env;
-        void* dummy;
+        JNIEnvDummy dummy;
     } u;
     jint jniError = 0;
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to