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

View File

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

View File

@ -48,6 +48,9 @@
#include <stdarg.h> #include <stdarg.h>
#include "prlog.h" #include "prlog.h"
#ifdef ANDROID
#include <android/log.h>
#endif
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsAutoPtr.h" #include "nsAutoPtr.h"
@ -204,7 +207,11 @@ Dump(JSContext *cx, uintN argc, jsval *vp)
if (!chars) if (!chars)
return JS_FALSE; 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); fflush(stdout);
return JS_TRUE; return JS_TRUE;
} }

View File

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