Bug 586010 - Send dump() output to Android device log. r=bz

--HG--
extra : rebase_source : f1712d831aaa6fbd8e1bfd6060fbb4aa951ccb74
This commit is contained in:
Justin Lebar 2011-11-09 19:27:08 -05:00
parent b11172f955
commit 3c1ff6be4d
4 changed files with 29 additions and 1 deletions

View File

@ -52,6 +52,10 @@
#include "nsIConsoleService.h"
#include "nsIProtocolHandler.h"
#ifdef ANDROID
#include <android/log.h>
#endif
static bool
IsChromeProcess()
{
@ -279,6 +283,9 @@ nsFrameMessageManager::SendAsyncMessage(const nsAString& aMessageName,
NS_IMETHODIMP
nsFrameMessageManager::Dump(const nsAString& aStr)
{
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "Gecko", NS_ConvertUTF16toUTF8(aStr).get());
#endif
fputs(NS_ConvertUTF16toUTF8(aStr).get(), stdout);
fflush(stdout);
return NS_OK;

View File

@ -253,6 +253,10 @@
#include "nsLocation.h"
#include "nsWrapperCacheInlines.h"
#ifdef ANDROID
#include <android/log.h>
#endif
#ifdef PR_LOGGING
static PRLogModuleInfo* gDOMLeakPRLog;
#endif
@ -4571,6 +4575,9 @@ nsGlobalWindow::Dump(const nsAString& aStr)
#endif
if (cstr) {
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "Gecko", cstr);
#endif
FILE *fp = gDumpFile ? gDumpFile : stdout;
fputs(cstr, fp);
fflush(fp);

View File

@ -48,6 +48,9 @@
#include <stdarg.h>
#include "prlog.h"
#ifdef ANDROID
#include <android/log.h>
#endif
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
@ -204,7 +207,11 @@ Dump(JSContext *cx, uintN argc, jsval *vp)
if (!chars)
return JS_FALSE;
fputs(NS_ConvertUTF16toUTF8(reinterpret_cast<const PRUnichar*>(chars)).get(), stdout);
NS_ConvertUTF16toUTF8 utf8str(reinterpret_cast<const PRUnichar*>(chars));
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "Gecko", utf8str.get());
#endif
fputs(utf8str.get(), stdout);
fflush(stdout);
return JS_TRUE;
}

View File

@ -90,6 +90,10 @@
#include <windows.h>
#endif
#ifdef ANDROID
#include <android/log.h>
#endif
#include "nsIScriptSecurityManager.h"
#include "nsIPrincipal.h"
@ -455,6 +459,9 @@ Dump(JSContext *cx, uintN argc, jsval *vp)
if (!bytes)
return JS_FALSE;
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "Gecko", bytes.ptr());
#endif
fputs(bytes.ptr(), gOutFile);
fflush(gOutFile);
return JS_TRUE;