OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2016 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 |
11 #include <map> | 11 #include <map> |
12 #include <memory> | 12 #include <memory> |
13 | 13 |
14 #include "webrtc/sdk/android/src/jni/classreferenceholder.h" | 14 #include "webrtc/sdk/android/src/jni/classreferenceholder.h" |
15 #include "webrtc/sdk/android/src/jni/jni_helpers.h" | 15 #include "webrtc/sdk/android/src/jni/jni_helpers.h" |
16 #include "webrtc/sdk/android/src/jni/native_handle_impl.h" | 16 |
| 17 #if defined(HAVE_WEBRTC_VOICE) && defined(HAVE_WEBRTC_VIDEO) |
| 18 #include "webrtc/sdk/android/src/jni/native_handle_impl.h" // nogncheck |
| 19 #endif |
| 20 |
17 #include "webrtc/system_wrappers/include/metrics.h" | 21 #include "webrtc/system_wrappers/include/metrics.h" |
18 | 22 |
19 // Enables collection of native histograms and creating them. | 23 // Enables collection of native histograms and creating them. |
20 namespace webrtc_jni { | 24 namespace webrtc_jni { |
21 | 25 |
22 JOW(jlong, Histogram_nativeCreateCounts) | 26 JOW(jlong, Histogram_nativeCreateCounts) |
23 (JNIEnv* jni, jclass, jstring j_name, jint min, jint max, jint buckets) { | 27 (JNIEnv* jni, jclass, jstring j_name, jint min, jint max, jint buckets) { |
24 std::string name = JavaToStdString(jni, j_name); | 28 std::string name = JavaToStdString(jni, j_name); |
25 return jlongFromPointer( | 29 return jlongFromPointer( |
26 webrtc::metrics::HistogramFactoryGetCounts(name, min, max, buckets)); | 30 webrtc::metrics::HistogramFactoryGetCounts(name, min, max, buckets)); |
27 } | 31 } |
28 | 32 |
29 JOW(jlong, Histogram_nativeCreateEnumeration) | 33 JOW(jlong, Histogram_nativeCreateEnumeration) |
30 (JNIEnv* jni, jclass, jstring j_name, jint max) { | 34 (JNIEnv* jni, jclass, jstring j_name, jint max) { |
31 std::string name = JavaToStdString(jni, j_name); | 35 std::string name = JavaToStdString(jni, j_name); |
32 return jlongFromPointer( | 36 return jlongFromPointer( |
33 webrtc::metrics::HistogramFactoryGetEnumeration(name, max)); | 37 webrtc::metrics::HistogramFactoryGetEnumeration(name, max)); |
34 } | 38 } |
35 | 39 |
36 JOW(void, Histogram_nativeAddSample) | 40 JOW(void, Histogram_nativeAddSample) |
37 (JNIEnv* jni, jclass, jlong histogram, jint sample) { | 41 (JNIEnv* jni, jclass, jlong histogram, jint sample) { |
38 if (histogram) { | 42 if (histogram) { |
39 HistogramAdd(reinterpret_cast<webrtc::metrics::Histogram*>(histogram), | 43 HistogramAdd(reinterpret_cast<webrtc::metrics::Histogram*>(histogram), |
40 sample); | 44 sample); |
41 } | 45 } |
42 } | 46 } |
43 | 47 |
44 } // namespace webrtc_jni | 48 } // namespace webrtc_jni |
OLD | NEW |