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

Unified Diff: webrtc/sdk/android/src/jni/jni_helpers.h

Issue 2992103002: Relanding: Break peerconnection_jni.cc into multiple files, in "pc" directory. (Closed)
Patch Set: Add jni/androidnetworkmonitor_jni.h include for backwards comaptibility. Created 3 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/sdk/android/src/jni/classreferenceholder.h ('k') | webrtc/sdk/android/src/jni/jni_helpers.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/sdk/android/src/jni/jni_helpers.h
diff --git a/webrtc/sdk/android/src/jni/jni_helpers.h b/webrtc/sdk/android/src/jni/jni_helpers.h
index 19b7741fb58633f1d0d288fceb024b71c7a661ad..e4c43a25bf2396ead2de0b449082df4f253b4759 100644
--- a/webrtc/sdk/android/src/jni/jni_helpers.h
+++ b/webrtc/sdk/android/src/jni/jni_helpers.h
@@ -34,6 +34,23 @@
#define CHECK_RELEASE(ptr) \
RTC_CHECK_EQ(0, (ptr)->Release()) << "Unexpected refcount."
+// Convenience macro defining JNI-accessible methods in the org.webrtc package.
+// Eliminates unnecessary boilerplate and line-wraps, reducing visual clutter.
+//
+// TODO(deadbeef): Rename this macro to something like
+// "JNI_FUNCTION_DECLARATION", and use variable length arguments, such that you
+// can write:
+//
+// JNI_FUNCTION_DECLARATION(void, nativeFoo, Type arg1, Type arg2) { ...
+//
+// Instead of:
+//
+// JNI_FUNCTION_DECLARATION(void, nativeFoo)(Type arg1, Type arg2) { ...
+//
+// The latter gets handled poorly by autoformatting tools.
+#define JOW(rettype, name) \
+ extern "C" JNIEXPORT rettype JNICALL Java_org_webrtc_##name
+
namespace webrtc_jni {
jint InitGlobalJniVariables(JavaVM *jvm);
@@ -97,6 +114,12 @@ std::string JavaToStdString(JNIEnv* jni, const jstring& j_string);
jobject JavaEnumFromIndex(JNIEnv* jni, jclass state_class,
const std::string& state_class_name, int index);
+// Return the (singleton) Java Enum object corresponding to |index|;
+// |state_class_fragment| is something like "MediaSource$State".
+jobject JavaEnumFromIndexAndClassName(JNIEnv* jni,
+ const std::string& state_class_fragment,
+ int index);
+
// Returns the name of a Java enum.
std::string GetJavaEnumName(JNIEnv* jni,
const std::string& className,
« no previous file with comments | « webrtc/sdk/android/src/jni/classreferenceholder.h ('k') | webrtc/sdk/android/src/jni/jni_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698