Android: Annotate and generate JNI code for Metrics.java
Bug: webrtc:8278
Change-Id: I54caee1acb483d7554afd6c0958f1929a78d6a56
Reviewed-on: https://webrtc-review.googlesource.com/22720
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20753}
diff --git a/sdk/android/api/org/webrtc/Metrics.java b/sdk/android/api/org/webrtc/Metrics.java
index ca19489..3057067 100644
--- a/sdk/android/api/org/webrtc/Metrics.java
+++ b/sdk/android/api/org/webrtc/Metrics.java
@@ -54,11 +54,13 @@
this.bucketCount = bucketCount;
}
+ @CalledByNative("HistogramInfo")
public void addSample(int value, int numEvents) {
samples.put(value, numEvents);
}
}
+ @CalledByNative
private void add(String name, HistogramInfo info) {
map.put(name, info);
}
@@ -66,14 +68,26 @@
// Enables gathering of metrics (which can be fetched with getAndReset()).
// Must be called before PeerConnectionFactory is created.
public static void enable() {
- nativeEnable();
+ enableNative();
}
// Gets and clears native histograms.
public static Metrics getAndReset() {
- return nativeGetAndReset();
+ return getAndResetNative();
}
- private static native void nativeEnable();
- private static native Metrics nativeGetAndReset();
+ // TODO(bugs.webrtc.org/8551) Remove.
+ @CalledByNative
+ static Metrics createMetrics() {
+ return new Metrics();
+ }
+
+ // TODO(bugs.webrtc.org/8551) Remove.
+ @CalledByNative
+ static HistogramInfo createHistogramInfo(int min, int max, int bucketCount) {
+ return new HistogramInfo(min, max, bucketCount);
+ }
+
+ private static native void enableNative();
+ private static native Metrics getAndResetNative();
}