OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 #include "webrtc/sdk/android/src/jni/jni_helpers.h" | 10 #include "webrtc/sdk/android/src/jni/jni_helpers.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 jmethodID state_values_id = GetStaticMethodID( | 266 jmethodID state_values_id = GetStaticMethodID( |
267 jni, state_class, "values", ("()[L" + state_class_name + ";").c_str()); | 267 jni, state_class, "values", ("()[L" + state_class_name + ";").c_str()); |
268 jobjectArray state_values = static_cast<jobjectArray>( | 268 jobjectArray state_values = static_cast<jobjectArray>( |
269 jni->CallStaticObjectMethod(state_class, state_values_id)); | 269 jni->CallStaticObjectMethod(state_class, state_values_id)); |
270 CHECK_EXCEPTION(jni) << "error during CallStaticObjectMethod"; | 270 CHECK_EXCEPTION(jni) << "error during CallStaticObjectMethod"; |
271 jobject ret = jni->GetObjectArrayElement(state_values, index); | 271 jobject ret = jni->GetObjectArrayElement(state_values, index); |
272 CHECK_EXCEPTION(jni) << "error during GetObjectArrayElement"; | 272 CHECK_EXCEPTION(jni) << "error during GetObjectArrayElement"; |
273 return ret; | 273 return ret; |
274 } | 274 } |
275 | 275 |
276 jobject JavaEnumFromIndexAndClassName(JNIEnv* jni, | |
277 const std::string& state_class_fragment, | |
278 int index) { | |
279 const std::string state_class = "org/webrtc/" + state_class_fragment; | |
280 return JavaEnumFromIndex(jni, FindClass(jni, state_class.c_str()), | |
281 state_class, index); | |
282 } | |
283 | |
284 std::string GetJavaEnumName(JNIEnv* jni, | 276 std::string GetJavaEnumName(JNIEnv* jni, |
285 const std::string& className, | 277 const std::string& className, |
286 jobject j_enum) { | 278 jobject j_enum) { |
287 jclass enumClass = FindClass(jni, className.c_str()); | 279 jclass enumClass = FindClass(jni, className.c_str()); |
288 jmethodID nameMethod = | 280 jmethodID nameMethod = |
289 GetMethodID(jni, enumClass, "name", "()Ljava/lang/String;"); | 281 GetMethodID(jni, enumClass, "name", "()Ljava/lang/String;"); |
290 jstring name = | 282 jstring name = |
291 reinterpret_cast<jstring>(jni->CallObjectMethod(j_enum, nameMethod)); | 283 reinterpret_cast<jstring>(jni->CallObjectMethod(j_enum, nameMethod)); |
292 CHECK_EXCEPTION(jni) << "error during CallObjectMethod for " << className | 284 CHECK_EXCEPTION(jni) << "error during CallObjectMethod for " << className |
293 << ".name"; | 285 << ".name"; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 RTC_CHECK(!AtEnd()); | 371 RTC_CHECK(!AtEnd()); |
380 return value_; | 372 return value_; |
381 } | 373 } |
382 | 374 |
383 bool Iterable::Iterator::AtEnd() const { | 375 bool Iterable::Iterator::AtEnd() const { |
384 RTC_CHECK(thread_checker_.CalledOnValidThread()); | 376 RTC_CHECK(thread_checker_.CalledOnValidThread()); |
385 return jni_ == nullptr || IsNull(jni_, iterator_); | 377 return jni_ == nullptr || IsNull(jni_, iterator_); |
386 } | 378 } |
387 | 379 |
388 } // namespace webrtc_jni | 380 } // namespace webrtc_jni |
OLD | NEW |