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

Unified Diff: webrtc/sdk/android/src/jni/pc/datachannel_jni.cc

Issue 2998403002: Android: Update convenience macro defining JNI-accessible methods (Closed)
Patch Set: 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
Index: webrtc/sdk/android/src/jni/pc/datachannel_jni.cc
diff --git a/webrtc/sdk/android/src/jni/pc/datachannel_jni.cc b/webrtc/sdk/android/src/jni/pc/datachannel_jni.cc
index 71621f5f02873dbd861cb2bda556c771bf81dda6..1a19bcef86de2ea1fe8a16bb180877bb02c5cd90 100644
--- a/webrtc/sdk/android/src/jni/pc/datachannel_jni.cc
+++ b/webrtc/sdk/android/src/jni/pc/datachannel_jni.cc
@@ -24,49 +24,68 @@ static webrtc::DataChannelInterface* ExtractNativeDC(JNIEnv* jni,
return reinterpret_cast<webrtc::DataChannelInterface*>(j_d);
}
-JOW(jlong, DataChannel_registerObserverNative)
-(JNIEnv* jni, jobject j_dc, jobject j_observer) {
+JNI_FUNCTION_DECLARATION(jlong,
+ DataChannel_registerObserverNative,
+ JNIEnv* jni,
+ jobject j_dc,
+ jobject j_observer) {
std::unique_ptr<DataChannelObserverJni> observer(
new DataChannelObserverJni(jni, j_observer));
ExtractNativeDC(jni, j_dc)->RegisterObserver(observer.get());
return jlongFromPointer(observer.release());
}
-JOW(void, DataChannel_unregisterObserverNative)
-(JNIEnv* jni, jobject j_dc, jlong native_observer) {
+JNI_FUNCTION_DECLARATION(void,
+ DataChannel_unregisterObserverNative,
+ JNIEnv* jni,
+ jobject j_dc,
+ jlong native_observer) {
ExtractNativeDC(jni, j_dc)->UnregisterObserver();
delete reinterpret_cast<DataChannelObserverJni*>(native_observer);
}
-JOW(jstring, DataChannel_label)(JNIEnv* jni, jobject j_dc) {
+JNI_FUNCTION_DECLARATION(jstring,
+ DataChannel_label,
+ JNIEnv* jni,
+ jobject j_dc) {
return JavaStringFromStdString(jni, ExtractNativeDC(jni, j_dc)->label());
}
-JOW(jint, DataChannel_id)(JNIEnv* jni, jobject j_dc) {
+JNI_FUNCTION_DECLARATION(jint, DataChannel_id, JNIEnv* jni, jobject j_dc) {
int id = ExtractNativeDC(jni, j_dc)->id();
RTC_CHECK_LE(id, std::numeric_limits<int32_t>::max())
<< "id overflowed jint!";
return static_cast<jint>(id);
}
-JOW(jobject, DataChannel_state)(JNIEnv* jni, jobject j_dc) {
+JNI_FUNCTION_DECLARATION(jobject,
+ DataChannel_state,
+ JNIEnv* jni,
+ jobject j_dc) {
return JavaEnumFromIndexAndClassName(jni, "DataChannel$State",
ExtractNativeDC(jni, j_dc)->state());
}
-JOW(jlong, DataChannel_bufferedAmount)(JNIEnv* jni, jobject j_dc) {
+JNI_FUNCTION_DECLARATION(jlong,
+ DataChannel_bufferedAmount,
+ JNIEnv* jni,
+ jobject j_dc) {
uint64_t buffered_amount = ExtractNativeDC(jni, j_dc)->buffered_amount();
RTC_CHECK_LE(buffered_amount, std::numeric_limits<int64_t>::max())
<< "buffered_amount overflowed jlong!";
return static_cast<jlong>(buffered_amount);
}
-JOW(void, DataChannel_close)(JNIEnv* jni, jobject j_dc) {
+JNI_FUNCTION_DECLARATION(void, DataChannel_close, JNIEnv* jni, jobject j_dc) {
ExtractNativeDC(jni, j_dc)->Close();
}
-JOW(jboolean, DataChannel_sendNative)
-(JNIEnv* jni, jobject j_dc, jbyteArray data, jboolean binary) {
+JNI_FUNCTION_DECLARATION(jboolean,
+ DataChannel_sendNative,
+ JNIEnv* jni,
+ jobject j_dc,
+ jbyteArray data,
+ jboolean binary) {
jbyte* bytes = jni->GetByteArrayElements(data, NULL);
bool ret = ExtractNativeDC(jni, j_dc)->Send(webrtc::DataBuffer(
rtc::CopyOnWriteBuffer(bytes, jni->GetArrayLength(data)), binary));
@@ -74,7 +93,7 @@ JOW(jboolean, DataChannel_sendNative)
return ret;
}
-JOW(void, DataChannel_dispose)(JNIEnv* jni, jobject j_dc) {
+JNI_FUNCTION_DECLARATION(void, DataChannel_dispose, JNIEnv* jni, jobject j_dc) {
CHECK_RELEASE(ExtractNativeDC(jni, j_dc));
}
« no previous file with comments | « webrtc/sdk/android/src/jni/pc/callsessionfilerotatinglogsink_jni.cc ('k') | webrtc/sdk/android/src/jni/pc/dtmfsender_jni.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698