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

Side by Side Diff: webrtc/sdk/android/src/jni/peerconnection_jni.cc

Issue 2584553002: New method StatsObserver::OnCompleteReports, passing ownership. (Closed)
Patch Set: Drop unneeded ".get()". Created 4 years 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 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2013 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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 "[Lorg/webrtc/StatsReport$Value;)V")), 664 "[Lorg/webrtc/StatsReport$Value;)V")),
665 j_value_class_(jni, FindClass( 665 j_value_class_(jni, FindClass(
666 jni, "org/webrtc/StatsReport$Value")), 666 jni, "org/webrtc/StatsReport$Value")),
667 j_value_ctor_(GetMethodID( 667 j_value_ctor_(GetMethodID(
668 jni, *j_value_class_, "<init>", 668 jni, *j_value_class_, "<init>",
669 "(Ljava/lang/String;Ljava/lang/String;)V")) { 669 "(Ljava/lang/String;Ljava/lang/String;)V")) {
670 } 670 }
671 671
672 virtual ~StatsObserverWrapper() {} 672 virtual ~StatsObserverWrapper() {}
673 673
674 void OnComplete(const StatsReports& reports) override { 674 void OnCompleteReports(std::unique_ptr<StatsReports> reports) override {
675 ScopedLocalRefFrame local_ref_frame(jni()); 675 ScopedLocalRefFrame local_ref_frame(jni());
676 jobjectArray j_reports = ReportsToJava(jni(), reports); 676 jobjectArray j_reports = ReportsToJava(jni(), *reports);
677 jmethodID m = GetMethodID(jni(), *j_observer_class_, "onComplete", 677 jmethodID m = GetMethodID(jni(), *j_observer_class_, "onComplete",
678 "([Lorg/webrtc/StatsReport;)V"); 678 "([Lorg/webrtc/StatsReport;)V");
679 jni()->CallVoidMethod(*j_observer_global_, m, j_reports); 679 jni()->CallVoidMethod(*j_observer_global_, m, j_reports);
680 CHECK_EXCEPTION(jni()) << "error during CallVoidMethod"; 680 CHECK_EXCEPTION(jni()) << "error during CallVoidMethod";
681 } 681 }
682 682
683 private: 683 private:
684 jobjectArray ReportsToJava( 684 jobjectArray ReportsToJava(
685 JNIEnv* jni, const StatsReports& reports) { 685 JNIEnv* jni, const StatsReports& reports) {
686 jobjectArray reports_array = jni->NewObjectArray( 686 jobjectArray reports_array = jni->NewObjectArray(
(...skipping 1780 matching lines...) Expand 10 before | Expand all | Expand 10 after
2467 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer) 2467 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)
2468 ->SetObserver(nullptr); 2468 ->SetObserver(nullptr);
2469 RtpReceiverObserver* observer = 2469 RtpReceiverObserver* observer =
2470 reinterpret_cast<RtpReceiverObserver*>(j_observer_pointer); 2470 reinterpret_cast<RtpReceiverObserver*>(j_observer_pointer);
2471 if (observer) { 2471 if (observer) {
2472 delete observer; 2472 delete observer;
2473 } 2473 }
2474 } 2474 }
2475 2475
2476 } // namespace webrtc_jni 2476 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « webrtc/api/test/mockpeerconnectionobservers.h ('k') | webrtc/sdk/objc/Framework/Classes/RTCPeerConnection+Stats.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698