Revert "Remove WEBRTC_TRACE."

This reverts commit 2209b90449473e1df3e0797b6271c7624b41907d.

Reason for revert: breaks Chromium

Original change's description:
> Remove WEBRTC_TRACE.
> 
> Bug: webrtc:5118
> Change-Id: I0af0f8845ee016fa61d7cecc526e2a672ec8732d
> Reviewed-on: https://webrtc-review.googlesource.com/5382
> Reviewed-by: Niels Moller <nisse@webrtc.org>
> Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#20114}

TBR=solenberg@webrtc.org,sakal@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org

Change-Id: Ie54fc05c1d7895c088cba410ed87a7c9a0701427
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:5118
Reviewed-on: https://webrtc-review.googlesource.com/5980
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20115}
This commit is contained in:
Fredrik Solenberg
2017-10-03 13:39:39 +00:00
committed by Commit Bot
parent 2209b90449
commit 729b9109ca
36 changed files with 1588 additions and 17 deletions

View File

@ -12,10 +12,32 @@
#include "rtc_base/logging.h"
#include "sdk/android/src/jni/jni_helpers.h"
#include "system_wrappers/include/logcat_trace_context.h"
#include "system_wrappers/include/trace.h"
namespace webrtc {
namespace jni {
JNI_FUNCTION_DECLARATION(void,
Logging_nativeEnableTracing,
JNIEnv* jni,
jclass,
jstring j_path,
jint nativeLevels) {
std::string path = JavaToStdString(jni, j_path);
if (nativeLevels != kTraceNone) {
Trace::set_level_filter(nativeLevels);
if (path != "logcat:") {
RTC_CHECK_EQ(0, Trace::SetTraceFile(path.c_str(), false))
<< "SetTraceFile failed";
} else {
// Intentionally leak this to avoid needing to reason about its lifecycle.
// It keeps no state and functions only as a dispatch point.
static LogcatTraceContext* g_trace_callback = new LogcatTraceContext();
}
}
}
JNI_FUNCTION_DECLARATION(void,
Logging_nativeEnableLogToDebugOutput,
JNIEnv* jni,

View File

@ -30,6 +30,7 @@
// We don't want to depend on 'system_wrappers:field_trial_default' because
// clients should be able to provide their own implementation.
#include "system_wrappers/include/field_trial_default.h" // nogncheck
#include "system_wrappers/include/trace.h"
namespace webrtc {
namespace jni {
@ -146,6 +147,7 @@ JNI_FUNCTION_DECLARATION(
// webrtc/rtc_base/ are convoluted, we simply wrap here to avoid having to
// think about ramifications of auto-wrapping there.
rtc::ThreadManager::Instance()->WrapCurrentThread();
Trace::CreateTrace();
std::unique_ptr<rtc::Thread> network_thread =
rtc::Thread::CreateWithSocketServer();
@ -223,6 +225,7 @@ JNI_FUNCTION_DECLARATION(void,
delete field_trials_init_string;
field_trials_init_string = NULL;
}
Trace::ReturnTrace();
}
JNI_FUNCTION_DECLARATION(void,