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 |
276 std::string GetJavaEnumName(JNIEnv* jni, | 284 std::string GetJavaEnumName(JNIEnv* jni, |
277 const std::string& className, | 285 const std::string& className, |
278 jobject j_enum) { | 286 jobject j_enum) { |
279 jclass enumClass = FindClass(jni, className.c_str()); | 287 jclass enumClass = FindClass(jni, className.c_str()); |
280 jmethodID nameMethod = | 288 jmethodID nameMethod = |
281 GetMethodID(jni, enumClass, "name", "()Ljava/lang/String;"); | 289 GetMethodID(jni, enumClass, "name", "()Ljava/lang/String;"); |
282 jstring name = | 290 jstring name = |
283 reinterpret_cast<jstring>(jni->CallObjectMethod(j_enum, nameMethod)); | 291 reinterpret_cast<jstring>(jni->CallObjectMethod(j_enum, nameMethod)); |
284 CHECK_EXCEPTION(jni) << "error during CallObjectMethod for " << className | 292 CHECK_EXCEPTION(jni) << "error during CallObjectMethod for " << className |
285 << ".name"; | 293 << ".name"; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 RTC_CHECK(!AtEnd()); | 379 RTC_CHECK(!AtEnd()); |
372 return value_; | 380 return value_; |
373 } | 381 } |
374 | 382 |
375 bool Iterable::Iterator::AtEnd() const { | 383 bool Iterable::Iterator::AtEnd() const { |
376 RTC_CHECK(thread_checker_.CalledOnValidThread()); | 384 RTC_CHECK(thread_checker_.CalledOnValidThread()); |
377 return jni_ == nullptr || IsNull(jni_, iterator_); | 385 return jni_ == nullptr || IsNull(jni_, iterator_); |
378 } | 386 } |
379 | 387 |
380 } // namespace webrtc_jni | 388 } // namespace webrtc_jni |
OLD | NEW |