| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/android/jni_android.h" | 5 #include "base/android/jni_android.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace { | 9 namespace { |
| 10 JavaVM* g_jvm = 0; | 10 JavaVM* g_jvm = 0; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 jmethodID GetMethodID(JNIEnv* env, | 49 jmethodID GetMethodID(JNIEnv* env, |
| 50 jclass clazz, | 50 jclass clazz, |
| 51 const char* const method, | 51 const char* const method, |
| 52 const char* const jni_signature) { | 52 const char* const jni_signature) { |
| 53 jmethodID id = env->GetMethodID(clazz, method, jni_signature); | 53 jmethodID id = env->GetMethodID(clazz, method, jni_signature); |
| 54 DCHECK(id) << method; | 54 DCHECK(id) << method; |
| 55 CheckException(env); | 55 CheckException(env); |
| 56 return id; | 56 return id; |
| 57 } | 57 } |
| 58 | 58 |
| 59 jmethodID GetStaticMethodID(JNIEnv* env, |
| 60 jclass clazz, |
| 61 const char* const method, |
| 62 const char* const jni_signature) { |
| 63 jmethodID id = env->GetStaticMethodID(clazz, method, jni_signature); |
| 64 DCHECK(id) << method; |
| 65 CheckException(env); |
| 66 return id; |
| 67 } |
| 68 |
| 59 bool CheckException(JNIEnv* env) { | 69 bool CheckException(JNIEnv* env) { |
| 60 if (env->ExceptionCheck() == JNI_FALSE) | 70 if (env->ExceptionCheck() == JNI_FALSE) |
| 61 return false; | 71 return false; |
| 62 env->ExceptionDescribe(); | 72 env->ExceptionDescribe(); |
| 63 env->ExceptionClear(); | 73 env->ExceptionClear(); |
| 64 return true; | 74 return true; |
| 65 } | 75 } |
| 66 | 76 |
| 67 } // namespace android | 77 } // namespace android |
| 68 } // namespace base | 78 } // namespace base |
| OLD | NEW |