| 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 | 10 |
| 11 // This file contain convenience functions and classes for JNI. | 11 // This file contain convenience functions and classes for JNI. |
| 12 // Before using any of the methods, InitGlobalJniVariables must be called. | 12 // Before using any of the methods, InitGlobalJniVariables must be called. |
| 13 | 13 |
| 14 #ifndef WEBRTC_SDK_ANDROID_SRC_JNI_JNI_HELPERS_H_ | 14 #ifndef WEBRTC_SDK_ANDROID_SRC_JNI_JNI_HELPERS_H_ |
| 15 #define WEBRTC_SDK_ANDROID_SRC_JNI_JNI_HELPERS_H_ | 15 #define WEBRTC_SDK_ANDROID_SRC_JNI_JNI_HELPERS_H_ |
| 16 | 16 |
| 17 #include <jni.h> | 17 #include <jni.h> |
| 18 #include <string> | 18 #include <string> |
| 19 | 19 |
| 20 #include "webrtc/rtc_base/checks.h" | 20 #include "webrtc/base/constructormagic.h" |
| 21 #include "webrtc/rtc_base/constructormagic.h" | 21 #include "webrtc/base/checks.h" |
| 22 #include "webrtc/rtc_base/thread_checker.h" | 22 #include "webrtc/base/thread_checker.h" |
| 23 | 23 |
| 24 // Abort the process if |jni| has a Java exception pending. | 24 // Abort the process if |jni| has a Java exception pending. |
| 25 // This macros uses the comma operator to execute ExceptionDescribe | 25 // This macros uses the comma operator to execute ExceptionDescribe |
| 26 // and ExceptionClear ignoring their return values and sending "" | 26 // and ExceptionClear ignoring their return values and sending "" |
| 27 // to the error stream. | 27 // to the error stream. |
| 28 #define CHECK_EXCEPTION(jni) \ | 28 #define CHECK_EXCEPTION(jni) \ |
| 29 RTC_CHECK(!jni->ExceptionCheck()) \ | 29 RTC_CHECK(!jni->ExceptionCheck()) \ |
| 30 << (jni->ExceptionDescribe(), jni->ExceptionClear(), "") | 30 << (jni->ExceptionDescribe(), jni->ExceptionClear(), "") |
| 31 | 31 |
| 32 // Helper that calls ptr->Release() and aborts the process with a useful | 32 // Helper that calls ptr->Release() and aborts the process with a useful |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 private: | 189 private: |
| 190 JNIEnv* jni_; | 190 JNIEnv* jni_; |
| 191 jobject iterable_; | 191 jobject iterable_; |
| 192 | 192 |
| 193 RTC_DISALLOW_COPY_AND_ASSIGN(Iterable); | 193 RTC_DISALLOW_COPY_AND_ASSIGN(Iterable); |
| 194 }; | 194 }; |
| 195 | 195 |
| 196 } // namespace webrtc_jni | 196 } // namespace webrtc_jni |
| 197 | 197 |
| 198 #endif // WEBRTC_SDK_ANDROID_SRC_JNI_JNI_HELPERS_H_ | 198 #endif // WEBRTC_SDK_ANDROID_SRC_JNI_JNI_HELPERS_H_ |
| OLD | NEW |