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

Side by Side Diff: talk/app/webrtc/java/jni/peerconnection_jni.cc

Issue 1338033003: Log to webrtc logging stream from java code. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: not lose tag Created 5 years, 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 921
922 JOW(void, Logging_nativeEnableLogThreads)(JNIEnv* jni, jclass) { 922 JOW(void, Logging_nativeEnableLogThreads)(JNIEnv* jni, jclass) {
923 rtc::LogMessage::LogThreads(true); 923 rtc::LogMessage::LogThreads(true);
924 } 924 }
925 925
926 JOW(void, Logging_nativeEnableLogTimeStamps)(JNIEnv* jni, jclass) { 926 JOW(void, Logging_nativeEnableLogTimeStamps)(JNIEnv* jni, jclass) {
927 rtc::LogMessage::LogTimestamps(true); 927 rtc::LogMessage::LogTimestamps(true);
928 } 928 }
929 929
930 JOW(void, Logging_nativeLog)( 930 JOW(void, Logging_nativeLog)(
931 JNIEnv* jni, jclass, jint j_severity, jstring j_message) { 931 JNIEnv* jni, jclass, jint j_severity, jstring j_tag, jstring j_message) {
932 std::string message = JavaToStdString(jni, j_message); 932 std::string message = JavaToStdString(jni, j_message);
933 LOG_V(static_cast<rtc::LoggingSeverity>(j_severity)) << message; 933 std::string tag = JavaToStdString(jni, j_tag);
934 LOG_TAG(static_cast<rtc::LoggingSeverity>(j_severity), tag) << message;
934 } 935 }
935 936
936 JOW(void, PeerConnection_freePeerConnection)(JNIEnv*, jclass, jlong j_p) { 937 JOW(void, PeerConnection_freePeerConnection)(JNIEnv*, jclass, jlong j_p) {
937 CHECK_RELEASE(reinterpret_cast<PeerConnectionInterface*>(j_p)); 938 CHECK_RELEASE(reinterpret_cast<PeerConnectionInterface*>(j_p));
938 } 939 }
939 940
940 JOW(void, PeerConnection_freeObserver)(JNIEnv*, jclass, jlong j_p) { 941 JOW(void, PeerConnection_freeObserver)(JNIEnv*, jclass, jlong j_p) {
941 PCOJava* p = reinterpret_cast<PCOJava*>(j_p); 942 PCOJava* p = reinterpret_cast<PCOJava*>(j_p);
942 delete p; 943 delete p;
943 } 944 }
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
1819 rtc::scoped_ptr<jbyte> buffer(static_cast<jbyte*>(malloc(log_size))); 1820 rtc::scoped_ptr<jbyte> buffer(static_cast<jbyte*>(malloc(log_size)));
1820 stream->ReadAll(buffer.get(), log_size, &read, nullptr); 1821 stream->ReadAll(buffer.get(), log_size, &read, nullptr);
1821 1822
1822 jbyteArray result = jni->NewByteArray(read); 1823 jbyteArray result = jni->NewByteArray(read);
1823 jni->SetByteArrayRegion(result, 0, read, buffer.get()); 1824 jni->SetByteArrayRegion(result, 0, read, buffer.get());
1824 1825
1825 return result; 1826 return result;
1826 } 1827 }
1827 1828
1828 } // namespace webrtc_jni 1829 } // namespace webrtc_jni
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698