Bug 1071359 - Make WebRTC on B2G uses logcat as logging sub-system. r=jesup

--HG--
extra : rebase_source : b55353ed698e1016ded9d79bd617c7adcbf06fb3
This commit is contained in:
Changbin Park 2014-09-23 13:57:33 +09:00
Родитель 52c3ba44a4
Коммит 145f8117a3
2 изменённых файлов: 17 добавлений и 0 удалений

Просмотреть файл

@ -7,6 +7,9 @@
#include "prlog.h" #include "prlog.h"
#include "prenv.h" #include "prenv.h"
#include "webrtc/system_wrappers/interface/trace.h" #include "webrtc/system_wrappers/interface/trace.h"
#ifdef WEBRTC_GONK
#include "webrtc/system_wrappers/interface/logcat_trace_context.h"
#endif
#include "nscore.h" #include "nscore.h"
#ifdef MOZILLA_INTERNAL_API #ifdef MOZILLA_INTERNAL_API
@ -53,6 +56,10 @@ public:
}; };
static WebRtcTraceCallback gWebRtcCallback; static WebRtcTraceCallback gWebRtcCallback;
#ifdef WEBRTC_GONK
static webrtc::LogcatTraceContext gWebRtcLogcatCallback;
#endif
#ifdef MOZILLA_INTERNAL_API #ifdef MOZILLA_INTERNAL_API
void GetWebRtcLogPrefs(uint32_t *aTraceMask, nsACString* aLogFile, nsACString *aAECLogDir, bool *aMultiLog) void GetWebRtcLogPrefs(uint32_t *aTraceMask, nsACString* aLogFile, nsACString *aAECLogDir, bool *aMultiLog)
@ -115,8 +122,13 @@ void ConfigWebRtcLog(uint32_t trace_mask, nsCString &aLogFile, nsCString &aAECLo
logFile.Append(default_log); logFile.Append(default_log);
} }
#elif defined(ANDROID) #elif defined(ANDROID)
#ifdef WEBRTC_GONK
// Special case: use callback to log through logcat.
logFile.Assign("logcat");
#else
// Special case: use callback to pipe to NSPR logging. // Special case: use callback to pipe to NSPR logging.
logFile.Assign("nspr"); logFile.Assign("nspr");
#endif
// for AEC, force the user to specify a directory // for AEC, force the user to specify a directory
aecLogDir.Assign("/dev/null"); aecLogDir.Assign("/dev/null");
#else #else
@ -137,6 +149,10 @@ void ConfigWebRtcLog(uint32_t trace_mask, nsCString &aLogFile, nsCString &aAECLo
if (trace_mask != 0) { if (trace_mask != 0) {
if (aLogFile.EqualsLiteral("nspr")) { if (aLogFile.EqualsLiteral("nspr")) {
webrtc::Trace::SetTraceCallback(&gWebRtcCallback); webrtc::Trace::SetTraceCallback(&gWebRtcCallback);
#ifdef WEBRTC_GONK
} else if (aLogFile.EqualsLiteral("logcat")) {
webrtc::Trace::SetTraceCallback(&gWebRtcLogcatCallback);
#endif
} else { } else {
webrtc::Trace::SetTraceFile(aLogFile.get(), multi_log); webrtc::Trace::SetTraceFile(aLogFile.get(), multi_log);
} }

Просмотреть файл

@ -188,6 +188,7 @@
['moz_widget_toolkit_gonk==1', { ['moz_widget_toolkit_gonk==1', {
'defines' : [ 'defines' : [
'WEBRTC_GONK', 'WEBRTC_GONK',
'WEBRTC_DIRECT_TRACE',
], ],
}], }],
['restrict_webrtc_logging==1', { ['restrict_webrtc_logging==1', {