Changeset 116405 in webkit


Ignore:
Timestamp:
May 8, 2012 2:00:08 AM (12 years ago)
Author:
abarth@webkit.org
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r116403 r116405  
     12012-05-08  Adam Barth  <abarth@webkit.org>
     2
     3        OS(ANDROID) JNI AttachCurrentThread take JNIEnv** as a parameter, not void**
     4        https://bugs.webkit.org/show_bug.cgi?id=85869
     5
     6        Reviewed by Eric Seidel.
     7
     8        According to
     9        http://docs.oracle.com/javase/1.5.0/docs/guide/jni/spec/invocation.html,
     10        AttachCurrentThread takes a JNIEnv** rather than a void**.  Apparently,
     11        most implementations actually take a void**.  The OS(ANDROID)
     12        implementation, however, actually takes an JNIEnv**.  This patch
     13        introduces a typedef to give each implementation what it desires.
     14
     15        * bridge/jni/JNIUtility.cpp:
     16        (JSC::Bindings::getJNIEnv):
     17
    1182012-05-08  Balazs Kelemen  <kbalazs@webkit.org>
    219
  • trunk/Source/WebCore/bridge/jni/JNIUtility.cpp

    r104406 r116405  
    8383}
    8484
     85// JDK 1.0 mistakenly declared the first parameter to AttachCurrentThread as
     86// void** rather than as JNIEnv**. This quirk appears to have been carried
     87// forward in implementations of Java despite what the documentation says.
     88// On OS(ANDROID), however, AttachCurrentThread appears to follow the
     89// documentation and expects a JNIEnv** parameter. The following typedef should
     90// give each implementation what it desires.
     91#if OS(ANDROID)
     92typedef JNIEnv* JNIEnvDummy;
     93#else
     94typedef void* JNIEnvDummy;
     95#endif
     96
    8597JNIEnv* getJNIEnv()
    8698{
    8799    union {
    88100        JNIEnv* env;
    89         void* dummy;
     101        JNIEnvDummy dummy;
    90102    } u;
    91103    jint jniError = 0;
Note: See TracChangeset for help on using the changeset viewer.