diff options
Diffstat (limited to 'src/native/java_lang_String.cc')
-rw-r--r-- | src/native/java_lang_String.cc | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/native/java_lang_String.cc b/src/native/java_lang_String.cc index f8fb4a745e..96fcf96287 100644 --- a/src/native/java_lang_String.cc +++ b/src/native/java_lang_String.cc @@ -16,6 +16,7 @@ #include "jni_internal.h" #include "object.h" +#include "scoped_jni_thread_state.h" #ifdef HAVE__MEMCMP16 // "count" is in 16-bit units. @@ -35,9 +36,9 @@ uint32_t MemCmp16(const uint16_t* s0, const uint16_t* s1, size_t count) { namespace art { static jint String_compareTo(JNIEnv* env, jobject javaThis, jobject javaRhs) { - ScopedThreadStateChange tsc(Thread::Current(), kRunnable); - String* lhs = Decode<String*>(env, javaThis); - String* rhs = Decode<String*>(env, javaRhs); + ScopedJniThreadState ts(env); + String* lhs = ts.Decode<String*>(javaThis); + String* rhs = ts.Decode<String*>(javaRhs); if (rhs == NULL) { Thread::Current()->ThrowNewException("Ljava/lang/NullPointerException;", "rhs == null"); @@ -69,10 +70,11 @@ static jint String_compareTo(JNIEnv* env, jobject javaThis, jobject javaRhs) { } static jint String_fastIndexOf(JNIEnv* env, jobject java_this, jint ch, jint start) { + ScopedJniThreadState ts(env); // This method does not handle supplementary characters. They're dealt with in managed code. DCHECK_LE(ch, 0xffff); - String* s = Decode<String*>(env, java_this); + String* s = ts.Decode<String*>(java_this); jint count = s->GetLength(); if (start < 0) { @@ -94,9 +96,10 @@ static jint String_fastIndexOf(JNIEnv* env, jobject java_this, jint ch, jint sta } static jstring String_intern(JNIEnv* env, jobject javaThis) { - String* s = Decode<String*>(env, javaThis); + ScopedJniThreadState ts(env); + String* s = ts.Decode<String*>(javaThis); String* result = s->Intern(); - return AddLocalReference<jstring>(env, result); + return ts.AddLocalReference<jstring>(result); } static JNINativeMethod gMethods[] = { |