henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Jonas Olsson | a4d8737 | 2019-07-05 19:08:33 +0200 | [diff] [blame] | 11 | #include "modules/utility/include/jvm_android.h" |
| 12 | |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 13 | #include <android/log.h> |
| 14 | |
kwiberg | 84be511 | 2016-04-27 01:19:58 -0700 | [diff] [blame] | 15 | #include <memory> |
| 16 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 17 | #include "rtc_base/checks.h" |
henrika | 53e048d | 2018-01-12 14:35:07 +0100 | [diff] [blame] | 18 | #include "rtc_base/logging.h" |
Magnus Jedvert | 9185bde | 2017-12-28 14:12:05 +0100 | [diff] [blame] | 19 | #include "rtc_base/platform_thread.h" |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 20 | |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 21 | namespace webrtc { |
| 22 | |
| 23 | JVM* g_jvm; |
| 24 | |
| 25 | // TODO(henrika): add more clases here if needed. |
| 26 | struct { |
| 27 | const char* name; |
| 28 | jclass clazz; |
| 29 | } loaded_classes[] = { |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 30 | }; |
| 31 | |
| 32 | // Android's FindClass() is trickier than usual because the app-specific |
| 33 | // ClassLoader is not consulted when there is no app-specific frame on the |
| 34 | // stack. Consequently, we only look up all classes once in native WebRTC. |
| 35 | // http://developer.android.com/training/articles/perf-jni.html#faq_FindClass |
| 36 | void LoadClasses(JNIEnv* jni) { |
Harald Alvestrand | 97597c0 | 2021-11-04 12:01:23 +0000 | [diff] [blame] | 37 | RTC_LOG(LS_INFO) << "LoadClasses:"; |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 38 | for (auto& c : loaded_classes) { |
| 39 | jclass localRef = FindClass(jni, c.name); |
Harald Alvestrand | 97597c0 | 2021-11-04 12:01:23 +0000 | [diff] [blame] | 40 | RTC_LOG(LS_INFO) << "name: " << c.name; |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 41 | CHECK_EXCEPTION(jni) << "Error during FindClass: " << c.name; |
henrikg | 91d6ede | 2015-09-17 00:24:34 -0700 | [diff] [blame] | 42 | RTC_CHECK(localRef) << c.name; |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 43 | jclass globalRef = reinterpret_cast<jclass>(jni->NewGlobalRef(localRef)); |
| 44 | CHECK_EXCEPTION(jni) << "Error during NewGlobalRef: " << c.name; |
henrikg | 91d6ede | 2015-09-17 00:24:34 -0700 | [diff] [blame] | 45 | RTC_CHECK(globalRef) << c.name; |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 46 | c.clazz = globalRef; |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | void FreeClassReferences(JNIEnv* jni) { |
| 51 | for (auto& c : loaded_classes) { |
| 52 | jni->DeleteGlobalRef(c.clazz); |
| 53 | c.clazz = nullptr; |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | jclass LookUpClass(const char* name) { |
| 58 | for (auto& c : loaded_classes) { |
sophiechang | f935bcc | 2015-07-07 01:10:14 -0700 | [diff] [blame] | 59 | if (strcmp(c.name, name) == 0) |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 60 | return c.clazz; |
| 61 | } |
henrikg | 91d6ede | 2015-09-17 00:24:34 -0700 | [diff] [blame] | 62 | RTC_CHECK(false) << "Unable to find class in lookup table"; |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 63 | return 0; |
| 64 | } |
| 65 | |
Mirko Bonadei | 977c820 | 2019-01-11 19:26:40 +0100 | [diff] [blame] | 66 | // JvmThreadConnector implementation. |
| 67 | JvmThreadConnector::JvmThreadConnector() : attached_(false) { |
Harald Alvestrand | 97597c0 | 2021-11-04 12:01:23 +0000 | [diff] [blame] | 68 | RTC_LOG(LS_INFO) << "JvmThreadConnector::ctor"; |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 69 | JavaVM* jvm = JVM::GetInstance()->jvm(); |
henrikg | 91d6ede | 2015-09-17 00:24:34 -0700 | [diff] [blame] | 70 | RTC_CHECK(jvm); |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 71 | JNIEnv* jni = GetEnv(jvm); |
| 72 | if (!jni) { |
Harald Alvestrand | 97597c0 | 2021-11-04 12:01:23 +0000 | [diff] [blame] | 73 | RTC_LOG(LS_INFO) << "Attaching thread to JVM"; |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 74 | JNIEnv* env = nullptr; |
| 75 | jint ret = jvm->AttachCurrentThread(&env, nullptr); |
| 76 | attached_ = (ret == JNI_OK); |
| 77 | } |
| 78 | } |
| 79 | |
Mirko Bonadei | 977c820 | 2019-01-11 19:26:40 +0100 | [diff] [blame] | 80 | JvmThreadConnector::~JvmThreadConnector() { |
Harald Alvestrand | 97597c0 | 2021-11-04 12:01:23 +0000 | [diff] [blame] | 81 | RTC_LOG(LS_INFO) << "JvmThreadConnector::dtor"; |
Sebastian Jansson | c01367d | 2019-04-08 15:20:44 +0200 | [diff] [blame] | 82 | RTC_DCHECK(thread_checker_.IsCurrent()); |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 83 | if (attached_) { |
Harald Alvestrand | 97597c0 | 2021-11-04 12:01:23 +0000 | [diff] [blame] | 84 | RTC_LOG(LS_INFO) << "Detaching thread from JVM"; |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 85 | jint res = JVM::GetInstance()->jvm()->DetachCurrentThread(); |
henrikg | 91d6ede | 2015-09-17 00:24:34 -0700 | [diff] [blame] | 86 | RTC_CHECK(res == JNI_OK) << "DetachCurrentThread failed: " << res; |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 87 | } |
| 88 | } |
| 89 | |
| 90 | // GlobalRef implementation. |
| 91 | GlobalRef::GlobalRef(JNIEnv* jni, jobject object) |
| 92 | : jni_(jni), j_object_(NewGlobalRef(jni, object)) { |
Harald Alvestrand | 97597c0 | 2021-11-04 12:01:23 +0000 | [diff] [blame] | 93 | RTC_LOG(LS_INFO) << "GlobalRef::ctor"; |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 94 | } |
| 95 | |
| 96 | GlobalRef::~GlobalRef() { |
Harald Alvestrand | 97597c0 | 2021-11-04 12:01:23 +0000 | [diff] [blame] | 97 | RTC_LOG(LS_INFO) << "GlobalRef::dtor"; |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 98 | DeleteGlobalRef(jni_, j_object_); |
| 99 | } |
| 100 | |
| 101 | jboolean GlobalRef::CallBooleanMethod(jmethodID methodID, ...) { |
| 102 | va_list args; |
| 103 | va_start(args, methodID); |
henrika | ee369e4 | 2015-05-25 10:11:27 +0200 | [diff] [blame] | 104 | jboolean res = jni_->CallBooleanMethodV(j_object_, methodID, args); |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 105 | CHECK_EXCEPTION(jni_) << "Error during CallBooleanMethod"; |
henrika | ee369e4 | 2015-05-25 10:11:27 +0200 | [diff] [blame] | 106 | va_end(args); |
| 107 | return res; |
| 108 | } |
| 109 | |
| 110 | jint GlobalRef::CallIntMethod(jmethodID methodID, ...) { |
| 111 | va_list args; |
| 112 | va_start(args, methodID); |
| 113 | jint res = jni_->CallIntMethodV(j_object_, methodID, args); |
| 114 | CHECK_EXCEPTION(jni_) << "Error during CallIntMethod"; |
| 115 | va_end(args); |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 116 | return res; |
| 117 | } |
| 118 | |
| 119 | void GlobalRef::CallVoidMethod(jmethodID methodID, ...) { |
| 120 | va_list args; |
| 121 | va_start(args, methodID); |
henrika | ee369e4 | 2015-05-25 10:11:27 +0200 | [diff] [blame] | 122 | jni_->CallVoidMethodV(j_object_, methodID, args); |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 123 | CHECK_EXCEPTION(jni_) << "Error during CallVoidMethod"; |
henrika | ee369e4 | 2015-05-25 10:11:27 +0200 | [diff] [blame] | 124 | va_end(args); |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 125 | } |
| 126 | |
| 127 | // NativeRegistration implementation. |
| 128 | NativeRegistration::NativeRegistration(JNIEnv* jni, jclass clazz) |
| 129 | : JavaClass(jni, clazz), jni_(jni) { |
Harald Alvestrand | 97597c0 | 2021-11-04 12:01:23 +0000 | [diff] [blame] | 130 | RTC_LOG(LS_INFO) << "NativeRegistration::ctor"; |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 131 | } |
| 132 | |
| 133 | NativeRegistration::~NativeRegistration() { |
Harald Alvestrand | 97597c0 | 2021-11-04 12:01:23 +0000 | [diff] [blame] | 134 | RTC_LOG(LS_INFO) << "NativeRegistration::dtor"; |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 135 | jni_->UnregisterNatives(j_class_); |
| 136 | CHECK_EXCEPTION(jni_) << "Error during UnregisterNatives"; |
| 137 | } |
| 138 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 139 | std::unique_ptr<GlobalRef> NativeRegistration::NewObject(const char* name, |
| 140 | const char* signature, |
| 141 | ...) { |
Harald Alvestrand | 97597c0 | 2021-11-04 12:01:23 +0000 | [diff] [blame] | 142 | RTC_LOG(LS_INFO) << "NativeRegistration::NewObject"; |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 143 | va_list args; |
| 144 | va_start(args, signature); |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 145 | jobject obj = jni_->NewObjectV( |
| 146 | j_class_, GetMethodID(jni_, j_class_, name, signature), args); |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 147 | CHECK_EXCEPTION(jni_) << "Error during NewObjectV"; |
| 148 | va_end(args); |
kwiberg | 84be511 | 2016-04-27 01:19:58 -0700 | [diff] [blame] | 149 | return std::unique_ptr<GlobalRef>(new GlobalRef(jni_, obj)); |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 150 | } |
| 151 | |
| 152 | // JavaClass implementation. |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 153 | jmethodID JavaClass::GetMethodId(const char* name, const char* signature) { |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 154 | return GetMethodID(jni_, j_class_, name, signature); |
| 155 | } |
| 156 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 157 | jmethodID JavaClass::GetStaticMethodId(const char* name, |
| 158 | const char* signature) { |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 159 | return GetStaticMethodID(jni_, j_class_, name, signature); |
| 160 | } |
| 161 | |
| 162 | jobject JavaClass::CallStaticObjectMethod(jmethodID methodID, ...) { |
| 163 | va_list args; |
| 164 | va_start(args, methodID); |
henrika | 7fc3f15 | 2017-07-11 03:52:09 -0700 | [diff] [blame] | 165 | jobject res = jni_->CallStaticObjectMethodV(j_class_, methodID, args); |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 166 | CHECK_EXCEPTION(jni_) << "Error during CallStaticObjectMethod"; |
| 167 | return res; |
| 168 | } |
| 169 | |
henrika | 918b554 | 2016-09-19 15:44:09 +0200 | [diff] [blame] | 170 | jint JavaClass::CallStaticIntMethod(jmethodID methodID, ...) { |
| 171 | va_list args; |
| 172 | va_start(args, methodID); |
henrika | 7fc3f15 | 2017-07-11 03:52:09 -0700 | [diff] [blame] | 173 | jint res = jni_->CallStaticIntMethodV(j_class_, methodID, args); |
henrika | 918b554 | 2016-09-19 15:44:09 +0200 | [diff] [blame] | 174 | CHECK_EXCEPTION(jni_) << "Error during CallStaticIntMethod"; |
| 175 | return res; |
| 176 | } |
| 177 | |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 178 | // JNIEnvironment implementation. |
| 179 | JNIEnvironment::JNIEnvironment(JNIEnv* jni) : jni_(jni) { |
Harald Alvestrand | 97597c0 | 2021-11-04 12:01:23 +0000 | [diff] [blame] | 180 | RTC_LOG(LS_INFO) << "JNIEnvironment::ctor"; |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 181 | } |
| 182 | |
| 183 | JNIEnvironment::~JNIEnvironment() { |
Harald Alvestrand | 97597c0 | 2021-11-04 12:01:23 +0000 | [diff] [blame] | 184 | RTC_LOG(LS_INFO) << "JNIEnvironment::dtor"; |
Sebastian Jansson | c01367d | 2019-04-08 15:20:44 +0200 | [diff] [blame] | 185 | RTC_DCHECK(thread_checker_.IsCurrent()); |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 186 | } |
| 187 | |
kwiberg | 84be511 | 2016-04-27 01:19:58 -0700 | [diff] [blame] | 188 | std::unique_ptr<NativeRegistration> JNIEnvironment::RegisterNatives( |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 189 | const char* name, |
| 190 | const JNINativeMethod* methods, |
| 191 | int num_methods) { |
Harald Alvestrand | 97597c0 | 2021-11-04 12:01:23 +0000 | [diff] [blame] | 192 | RTC_LOG(LS_INFO) << "JNIEnvironment::RegisterNatives: " << name; |
Sebastian Jansson | c01367d | 2019-04-08 15:20:44 +0200 | [diff] [blame] | 193 | RTC_DCHECK(thread_checker_.IsCurrent()); |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 194 | jclass clazz = LookUpClass(name); |
| 195 | jni_->RegisterNatives(clazz, methods, num_methods); |
| 196 | CHECK_EXCEPTION(jni_) << "Error during RegisterNatives"; |
kwiberg | 84be511 | 2016-04-27 01:19:58 -0700 | [diff] [blame] | 197 | return std::unique_ptr<NativeRegistration>( |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 198 | new NativeRegistration(jni_, clazz)); |
| 199 | } |
| 200 | |
| 201 | std::string JNIEnvironment::JavaToStdString(const jstring& j_string) { |
Sebastian Jansson | c01367d | 2019-04-08 15:20:44 +0200 | [diff] [blame] | 202 | RTC_DCHECK(thread_checker_.IsCurrent()); |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 203 | const char* jchars = jni_->GetStringUTFChars(j_string, nullptr); |
| 204 | CHECK_EXCEPTION(jni_); |
| 205 | const int size = jni_->GetStringUTFLength(j_string); |
| 206 | CHECK_EXCEPTION(jni_); |
| 207 | std::string ret(jchars, size); |
| 208 | jni_->ReleaseStringUTFChars(j_string, jchars); |
| 209 | CHECK_EXCEPTION(jni_); |
| 210 | return ret; |
| 211 | } |
| 212 | |
| 213 | // static |
sakal | d7fdb80 | 2017-05-26 01:51:53 -0700 | [diff] [blame] | 214 | void JVM::Initialize(JavaVM* jvm) { |
Harald Alvestrand | 97597c0 | 2021-11-04 12:01:23 +0000 | [diff] [blame] | 215 | RTC_LOG(LS_INFO) << "JVM::Initialize"; |
henrikg | 91d6ede | 2015-09-17 00:24:34 -0700 | [diff] [blame] | 216 | RTC_CHECK(!g_jvm); |
sakal | d7fdb80 | 2017-05-26 01:51:53 -0700 | [diff] [blame] | 217 | g_jvm = new JVM(jvm); |
| 218 | } |
| 219 | |
| 220 | void JVM::Initialize(JavaVM* jvm, jobject context) { |
| 221 | Initialize(jvm); |
| 222 | |
| 223 | // Pass in the context to the new ContextUtils class. |
| 224 | JNIEnv* jni = g_jvm->jni(); |
| 225 | jclass context_utils = FindClass(jni, "org/webrtc/ContextUtils"); |
| 226 | jmethodID initialize_method = jni->GetStaticMethodID( |
| 227 | context_utils, "initialize", "(Landroid/content/Context;)V"); |
| 228 | jni->CallStaticVoidMethod(context_utils, initialize_method, context); |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 229 | } |
| 230 | |
| 231 | // static |
| 232 | void JVM::Uninitialize() { |
Harald Alvestrand | 97597c0 | 2021-11-04 12:01:23 +0000 | [diff] [blame] | 233 | RTC_LOG(LS_INFO) << "JVM::Uninitialize"; |
henrikg | 91d6ede | 2015-09-17 00:24:34 -0700 | [diff] [blame] | 234 | RTC_DCHECK(g_jvm); |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 235 | delete g_jvm; |
| 236 | g_jvm = nullptr; |
| 237 | } |
| 238 | |
| 239 | // static |
| 240 | JVM* JVM::GetInstance() { |
henrikg | 91d6ede | 2015-09-17 00:24:34 -0700 | [diff] [blame] | 241 | RTC_DCHECK(g_jvm); |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 242 | return g_jvm; |
| 243 | } |
| 244 | |
sakal | d7fdb80 | 2017-05-26 01:51:53 -0700 | [diff] [blame] | 245 | JVM::JVM(JavaVM* jvm) : jvm_(jvm) { |
Harald Alvestrand | 97597c0 | 2021-11-04 12:01:23 +0000 | [diff] [blame] | 246 | RTC_LOG(LS_INFO) << "JVM::JVM"; |
henrikg | 91d6ede | 2015-09-17 00:24:34 -0700 | [diff] [blame] | 247 | RTC_CHECK(jni()) << "AttachCurrentThread() must be called on this thread."; |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 248 | LoadClasses(jni()); |
| 249 | } |
| 250 | |
| 251 | JVM::~JVM() { |
Harald Alvestrand | 97597c0 | 2021-11-04 12:01:23 +0000 | [diff] [blame] | 252 | RTC_LOG(LS_INFO) << "JVM::~JVM"; |
Sebastian Jansson | c01367d | 2019-04-08 15:20:44 +0200 | [diff] [blame] | 253 | RTC_DCHECK(thread_checker_.IsCurrent()); |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 254 | FreeClassReferences(jni()); |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 255 | } |
| 256 | |
kwiberg | 84be511 | 2016-04-27 01:19:58 -0700 | [diff] [blame] | 257 | std::unique_ptr<JNIEnvironment> JVM::environment() { |
Harald Alvestrand | 97597c0 | 2021-11-04 12:01:23 +0000 | [diff] [blame] | 258 | RTC_LOG(LS_INFO) << "JVM::environment"; |
henrika | 53e048d | 2018-01-12 14:35:07 +0100 | [diff] [blame] | 259 | ; |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 260 | // The JNIEnv is used for thread-local storage. For this reason, we cannot |
| 261 | // share a JNIEnv between threads. If a piece of code has no other way to get |
| 262 | // its JNIEnv, we should share the JavaVM, and use GetEnv to discover the |
| 263 | // thread's JNIEnv. (Assuming it has one, if not, use AttachCurrentThread). |
| 264 | // See // http://developer.android.com/training/articles/perf-jni.html. |
| 265 | JNIEnv* jni = GetEnv(jvm_); |
| 266 | if (!jni) { |
henrika | 53e048d | 2018-01-12 14:35:07 +0100 | [diff] [blame] | 267 | RTC_LOG(LS_ERROR) |
| 268 | << "AttachCurrentThread() has not been called on this thread"; |
kwiberg | 84be511 | 2016-04-27 01:19:58 -0700 | [diff] [blame] | 269 | return std::unique_ptr<JNIEnvironment>(); |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 270 | } |
kwiberg | 84be511 | 2016-04-27 01:19:58 -0700 | [diff] [blame] | 271 | return std::unique_ptr<JNIEnvironment>(new JNIEnvironment(jni)); |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 272 | } |
| 273 | |
| 274 | JavaClass JVM::GetClass(const char* name) { |
Harald Alvestrand | 97597c0 | 2021-11-04 12:01:23 +0000 | [diff] [blame] | 275 | RTC_LOG(LS_INFO) << "JVM::GetClass: " << name; |
Sebastian Jansson | c01367d | 2019-04-08 15:20:44 +0200 | [diff] [blame] | 276 | RTC_DCHECK(thread_checker_.IsCurrent()); |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 277 | return JavaClass(jni(), LookUpClass(name)); |
| 278 | } |
| 279 | |
| 280 | } // namespace webrtc |