| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 * | 26 * |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 // Android's FindClass() is trickier than usual because the app-specific | 29 // Android's FindClass() is trickier than usual because the app-specific |
| 30 // ClassLoader is not consulted when there is no app-specific frame on the | 30 // ClassLoader is not consulted when there is no app-specific frame on the |
| 31 // stack. Consequently, we only look up all classes once in app/webrtc. | 31 // stack. Consequently, we only look up all classes once in app/webrtc. |
| 32 // http://developer.android.com/training/articles/perf-jni.html#faq_FindClass | 32 // http://developer.android.com/training/articles/perf-jni.html#faq_FindClass |
| 33 | 33 |
| 34 #ifndef TALK_APP_WEBRTC_JAVA_JNI_CLASSREFERENCEHOLDER_H_ | 34 #ifndef WEBRTC_API_JAVA_JNI_CLASSREFERENCEHOLDER_H_ |
| 35 #define TALK_APP_WEBRTC_JAVA_JNI_CLASSREFERENCEHOLDER_H_ | 35 #define WEBRTC_API_JAVA_JNI_CLASSREFERENCEHOLDER_H_ |
| 36 | 36 |
| 37 #include <jni.h> | 37 #include <jni.h> |
| 38 #include <map> |
| 38 #include <string> | 39 #include <string> |
| 39 #include <map> | |
| 40 | 40 |
| 41 namespace webrtc_jni { | 41 namespace webrtc_jni { |
| 42 | 42 |
| 43 // LoadGlobalClassReferenceHolder must be called in JNI_OnLoad. | 43 // LoadGlobalClassReferenceHolder must be called in JNI_OnLoad. |
| 44 void LoadGlobalClassReferenceHolder(); | 44 void LoadGlobalClassReferenceHolder(); |
| 45 // FreeGlobalClassReferenceHolder must be called in JNI_UnLoad. | 45 // FreeGlobalClassReferenceHolder must be called in JNI_UnLoad. |
| 46 void FreeGlobalClassReferenceHolder(); | 46 void FreeGlobalClassReferenceHolder(); |
| 47 | 47 |
| 48 // Returns a global reference guaranteed to be valid for the lifetime of the | 48 // Returns a global reference guaranteed to be valid for the lifetime of the |
| 49 // process. | 49 // process. |
| 50 jclass FindClass(JNIEnv* jni, const char* name); | 50 jclass FindClass(JNIEnv* jni, const char* name); |
| 51 | 51 |
| 52 // Convenience macro defining JNI-accessible methods in the org.webrtc package. | 52 // Convenience macro defining JNI-accessible methods in the org.webrtc package. |
| 53 // Eliminates unnecessary boilerplate and line-wraps, reducing visual clutter. | 53 // Eliminates unnecessary boilerplate and line-wraps, reducing visual clutter. |
| 54 #define JOW(rettype, name) extern "C" rettype JNIEXPORT JNICALL \ | 54 #define JOW(rettype, name) extern "C" rettype JNIEXPORT JNICALL \ |
| 55 Java_org_webrtc_##name | 55 Java_org_webrtc_##name |
| 56 | 56 |
| 57 } // namespace webrtc_jni | 57 } // namespace webrtc_jni |
| 58 | 58 |
| 59 #endif // TALK_APP_WEBRTC_JAVA_JNI_CLASSREFERENCEHOLDER_H_ | 59 #endif // WEBRTC_API_JAVA_JNI_CLASSREFERENCEHOLDER_H_ |
| OLD | NEW |