diff options
author | Steve Block <steveblock@google.com> | 2010-11-01 13:16:30 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-11-01 15:49:26 +0000 |
commit | f947415b59bf9cc2a85a73ef8b3f3d99c9c65199 (patch) | |
tree | d10c545238bdcbe469f7ef2734e95863d635afc8 /WebKit/android/jni/WebCoreJni.h | |
parent | 5f2149d97da7a452dc97a39cfe9882436cc3dbc7 (diff) | |
download | external_webkit-f947415b59bf9cc2a85a73ef8b3f3d99c9c65199.zip external_webkit-f947415b59bf9cc2a85a73ef8b3f3d99c9c65199.tar.gz external_webkit-f947415b59bf9cc2a85a73ef8b3f3d99c9c65199.tar.bz2 |
Fix WebCoreStringToJString() to not delete the local reference to the new jstring
The JNI spec allows for local objects to be GC'ed before the JNI frame
returns, so this is dangerous.
Also rename the method to WtfStringToJstring() to match the existing
jstringToWtfString() and update call sites to JNIEnv::NewString() to
make use of it.
Change-Id: I84aa25ba1aca2aee346bf6e3d83a58afc3a95219
Diffstat (limited to 'WebKit/android/jni/WebCoreJni.h')
-rw-r--r-- | WebKit/android/jni/WebCoreJni.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/WebKit/android/jni/WebCoreJni.h b/WebKit/android/jni/WebCoreJni.h index d4a9821..26da3d5 100644 --- a/WebKit/android/jni/WebCoreJni.h +++ b/WebKit/android/jni/WebCoreJni.h @@ -71,13 +71,15 @@ AutoJObject getRealObject(JNIEnv*, jobject); bool checkException(JNIEnv* env); // Create a WTF::String object from a jstring object. -WTF::String jstringToWtfString(JNIEnv* env, jstring str); +WTF::String jstringToWtfString(JNIEnv*, jstring); +// Returns a local reference to a new jstring. +jstring WtfStringToJstring(JNIEnv*, const WTF::String&); #if USE(CHROME_NETWORK_STACK) -string16 jstringToString16(JNIEnv* env, jstring jstr); +string16 jstringToString16(JNIEnv*, jstring); #endif -std::string jstringToStdString(JNIEnv* env, jstring jstr); +std::string jstringToStdString(JNIEnv*, jstring); } |