Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: webrtc/sdk/android/src/jni/jni_helpers.h

Issue 2998403002: Android: Update convenience macro defining JNI-accessible methods (Closed)
Patch Set: Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
(...skipping 18 matching lines...) Expand all
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
33 // message if that didn't actually delete *ptr because of extra refcounts. 33 // message if that didn't actually delete *ptr because of extra refcounts.
34 #define CHECK_RELEASE(ptr) \ 34 #define CHECK_RELEASE(ptr) \
35 RTC_CHECK_EQ(0, (ptr)->Release()) << "Unexpected refcount." 35 RTC_CHECK_EQ(0, (ptr)->Release()) << "Unexpected refcount."
36 36
37 // Convenience macro defining JNI-accessible methods in the org.webrtc package. 37 // Convenience macro defining JNI-accessible methods in the org.webrtc package.
38 // Eliminates unnecessary boilerplate and line-wraps, reducing visual clutter. 38 // Eliminates unnecessary boilerplate and line-wraps, reducing visual clutter.
39 // 39 #define JNI_FUNCTION_DECLARATION(rettype, name, ...) \
40 // TODO(deadbeef): Rename this macro to something like 40 extern "C" JNIEXPORT rettype JNICALL Java_org_webrtc_##name(__VA_ARGS__)
41 // "JNI_FUNCTION_DECLARATION", and use variable length arguments, such that you
42 // can write:
43 //
44 // JNI_FUNCTION_DECLARATION(void, nativeFoo, Type arg1, Type arg2) { ...
45 //
46 // Instead of:
47 //
48 // JNI_FUNCTION_DECLARATION(void, nativeFoo)(Type arg1, Type arg2) { ...
49 //
50 // The latter gets handled poorly by autoformatting tools.
51 #define JOW(rettype, name) \
52 extern "C" JNIEXPORT rettype JNICALL Java_org_webrtc_##name
53 41
54 namespace webrtc_jni { 42 namespace webrtc_jni {
55 43
56 jint InitGlobalJniVariables(JavaVM *jvm); 44 jint InitGlobalJniVariables(JavaVM *jvm);
57 45
58 // Return a |JNIEnv*| usable on this thread or NULL if this thread is detached. 46 // Return a |JNIEnv*| usable on this thread or NULL if this thread is detached.
59 JNIEnv* GetEnv(); 47 JNIEnv* GetEnv();
60 48
61 JavaVM *GetJVM(); 49 JavaVM *GetJVM();
62 50
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 private: 200 private:
213 JNIEnv* jni_; 201 JNIEnv* jni_;
214 jobject iterable_; 202 jobject iterable_;
215 203
216 RTC_DISALLOW_COPY_AND_ASSIGN(Iterable); 204 RTC_DISALLOW_COPY_AND_ASSIGN(Iterable);
217 }; 205 };
218 206
219 } // namespace webrtc_jni 207 } // namespace webrtc_jni
220 208
221 #endif // WEBRTC_SDK_ANDROID_SRC_JNI_JNI_HELPERS_H_ 209 #endif // WEBRTC_SDK_ANDROID_SRC_JNI_JNI_HELPERS_H_
OLDNEW
« no previous file with comments | « webrtc/sdk/android/src/jni/androidvideotracksource_jni.cc ('k') | webrtc/sdk/android/src/jni/pc/androidnetworkmonitor_jni.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698