Loading mozglue/android/APKOpen.cpp +20 −2 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ #ifndef MOZ_OLD_LINKER #include "ElfLoader.h" #endif #include "application.ini.h" /* Android headers don't define RUSAGE_THREAD */ #ifndef RUSAGE_THREAD Loading Loading @@ -282,7 +283,6 @@ Java_org_mozilla_gecko_GeckoAppShell_ ## name(JNIEnv *jenv, jclass jc, type1 one } SHELL_WRAPPER0(nativeInit) SHELL_WRAPPER1(nativeRun, jstring) SHELL_WRAPPER1(notifyGeckoOfEvent, jobject) SHELL_WRAPPER0(processNextNativeEvent) SHELL_WRAPPER1(setSurfaceView, jobject) Loading Loading @@ -694,7 +694,6 @@ loadGeckoLibs(const char *apkName) #define GETFUNC(name) f_ ## name = (name ## _t) __wrap_dlsym(xul_handle, "Java_org_mozilla_gecko_GeckoAppShell_" #name) GETFUNC(nativeInit); GETFUNC(nativeRun); GETFUNC(notifyGeckoOfEvent); GETFUNC(processNextNativeEvent); GETFUNC(setSurfaceView); Loading Loading @@ -813,6 +812,25 @@ Java_org_mozilla_gecko_GeckoAppShell_loadSQLiteLibsNative(JNIEnv *jenv, jclass j jenv->ReleaseStringUTFChars(jApkName, str); } typedef void (*GeckoStart_t)(void *, const nsXREAppData *); extern "C" NS_EXPORT void JNICALL Java_org_mozilla_gecko_GeckoAppShell_nativeRun(JNIEnv *jenv, jclass jc, jstring jargs) { GeckoStart_t GeckoStart = (GeckoStart_t) __wrap_dlsym(xul_handle, "GeckoStart"); if (GeckoStart == NULL) return; // XXX: java doesn't give us true UTF8, we should figure out something // better to do here int len = jenv->GetStringUTFLength(jargs); // GeckoStart needs to write in the args buffer, so we need a copy. char *args = (char *) malloc(len + 1); jenv->GetStringUTFRegion(jargs, 0, len, args); args[len] = '\0'; GeckoStart(args, &sAppData); free(args); } typedef int GeckoProcessType; typedef int nsresult; Loading mozglue/android/Makefile.in +3 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,9 @@ CPPSRCS = \ SQLiteBridge.cpp \ $(NULL) LOCAL_INCLUDES += -I$(DEPTH)/build LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/build LOCAL_INCLUDES += -I$(srcdir)/../linker LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/components/startup LOCAL_INCLUDES += -I$(topsrcdir)/db/sqlite3/src Loading toolkit/xre/Makefile.in +0 −5 Original line number Diff line number Diff line Loading @@ -199,11 +199,6 @@ LOCAL_INCLUDES += \ -I$(topsrcdir)/config \ $(NULL) ifdef MOZ_APP_STATIC_INI LOCAL_INCLUDES += -I$(DEPTH)/build DEFINES += -DMOZ_APP_STATIC_INI endif CXXFLAGS += $(TK_CFLAGS) $(MOZ_DBUS_CFLAGS) $(MOZ_DBUS_GLIB_CFLAGS) ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2) Loading toolkit/xre/nsAndroidStartup.cpp +14 −30 Original line number Diff line number Diff line Loading @@ -39,9 +39,6 @@ * * ***** END LICENSE BLOCK ***** */ #include "nsXULAppAPI.h" #include "application.ini.h" #include <android/log.h> #include <jni.h> Loading @@ -60,6 +57,14 @@ #define LOG(args...) __android_log_print(ANDROID_LOG_INFO, MOZ_APP_NAME, args) // We need to put Gecko on a even more separate thread, because // otherwise this JNI method never returns; this leads to problems // with local references overrunning the local refs table, among // other things, since GC can't ever run on them. // Note that we don't have xpcom initialized yet, so we can't use the // thread manager for this. Instead, we use pthreads directly. struct AutoAttachJavaThread { AutoAttachJavaThread() { attached = mozilla_AndroidBridge_SetMainThread((void*)pthread_self()); Loading @@ -72,8 +77,8 @@ struct AutoAttachJavaThread { bool attached; }; static void* GeckoStart(void *data) extern "C" NS_EXPORT void GeckoStart(void *data, const nsXREAppData *appData) { #ifdef MOZ_CRASHREPORTER const struct mapping_info *info = getLibraryMapping(); Loading @@ -86,11 +91,11 @@ GeckoStart(void *data) AutoAttachJavaThread attacher; if (!attacher.attached) return 0; return; if (!data) { LOG("Failed to get arguments for GeckoStart\n"); return 0; return; } nsTArray<char *> targs; Loading @@ -101,7 +106,7 @@ GeckoStart(void *data) } targs.AppendElement(static_cast<char *>(nsnull)); int result = XRE_main(targs.Length() - 1, targs.Elements(), &sAppData); int result = XRE_main(targs.Length() - 1, targs.Elements(), appData); if (result) LOG("XRE_main returned %d", result); Loading @@ -110,26 +115,5 @@ GeckoStart(void *data) free(targs[0]); nsMemory::Free(data); return 0; } extern "C" NS_EXPORT void JNICALL Java_org_mozilla_gecko_GeckoAppShell_nativeRun(JNIEnv *jenv, jclass jc, jstring jargs) { // We need to put Gecko on a even more separate thread, because // otherwise this JNI method never returns; this leads to problems // with local references overrunning the local refs table, among // other things, since GC can't ever run on them. // Note that we don't have xpcom initialized yet, so we can't use the // thread manager for this. Instead, we use pthreads directly. nsAutoString wargs; int len = jenv->GetStringLength(jargs); wargs.SetLength(jenv->GetStringLength(jargs)); jenv->GetStringRegion(jargs, 0, len, wargs.BeginWriting()); char *args = ToNewUTF8String(wargs); GeckoStart(args); return; } Loading
mozglue/android/APKOpen.cpp +20 −2 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ #ifndef MOZ_OLD_LINKER #include "ElfLoader.h" #endif #include "application.ini.h" /* Android headers don't define RUSAGE_THREAD */ #ifndef RUSAGE_THREAD Loading Loading @@ -282,7 +283,6 @@ Java_org_mozilla_gecko_GeckoAppShell_ ## name(JNIEnv *jenv, jclass jc, type1 one } SHELL_WRAPPER0(nativeInit) SHELL_WRAPPER1(nativeRun, jstring) SHELL_WRAPPER1(notifyGeckoOfEvent, jobject) SHELL_WRAPPER0(processNextNativeEvent) SHELL_WRAPPER1(setSurfaceView, jobject) Loading Loading @@ -694,7 +694,6 @@ loadGeckoLibs(const char *apkName) #define GETFUNC(name) f_ ## name = (name ## _t) __wrap_dlsym(xul_handle, "Java_org_mozilla_gecko_GeckoAppShell_" #name) GETFUNC(nativeInit); GETFUNC(nativeRun); GETFUNC(notifyGeckoOfEvent); GETFUNC(processNextNativeEvent); GETFUNC(setSurfaceView); Loading Loading @@ -813,6 +812,25 @@ Java_org_mozilla_gecko_GeckoAppShell_loadSQLiteLibsNative(JNIEnv *jenv, jclass j jenv->ReleaseStringUTFChars(jApkName, str); } typedef void (*GeckoStart_t)(void *, const nsXREAppData *); extern "C" NS_EXPORT void JNICALL Java_org_mozilla_gecko_GeckoAppShell_nativeRun(JNIEnv *jenv, jclass jc, jstring jargs) { GeckoStart_t GeckoStart = (GeckoStart_t) __wrap_dlsym(xul_handle, "GeckoStart"); if (GeckoStart == NULL) return; // XXX: java doesn't give us true UTF8, we should figure out something // better to do here int len = jenv->GetStringUTFLength(jargs); // GeckoStart needs to write in the args buffer, so we need a copy. char *args = (char *) malloc(len + 1); jenv->GetStringUTFRegion(jargs, 0, len, args); args[len] = '\0'; GeckoStart(args, &sAppData); free(args); } typedef int GeckoProcessType; typedef int nsresult; Loading
mozglue/android/Makefile.in +3 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,9 @@ CPPSRCS = \ SQLiteBridge.cpp \ $(NULL) LOCAL_INCLUDES += -I$(DEPTH)/build LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/build LOCAL_INCLUDES += -I$(srcdir)/../linker LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/components/startup LOCAL_INCLUDES += -I$(topsrcdir)/db/sqlite3/src Loading
toolkit/xre/Makefile.in +0 −5 Original line number Diff line number Diff line Loading @@ -199,11 +199,6 @@ LOCAL_INCLUDES += \ -I$(topsrcdir)/config \ $(NULL) ifdef MOZ_APP_STATIC_INI LOCAL_INCLUDES += -I$(DEPTH)/build DEFINES += -DMOZ_APP_STATIC_INI endif CXXFLAGS += $(TK_CFLAGS) $(MOZ_DBUS_CFLAGS) $(MOZ_DBUS_GLIB_CFLAGS) ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2) Loading
toolkit/xre/nsAndroidStartup.cpp +14 −30 Original line number Diff line number Diff line Loading @@ -39,9 +39,6 @@ * * ***** END LICENSE BLOCK ***** */ #include "nsXULAppAPI.h" #include "application.ini.h" #include <android/log.h> #include <jni.h> Loading @@ -60,6 +57,14 @@ #define LOG(args...) __android_log_print(ANDROID_LOG_INFO, MOZ_APP_NAME, args) // We need to put Gecko on a even more separate thread, because // otherwise this JNI method never returns; this leads to problems // with local references overrunning the local refs table, among // other things, since GC can't ever run on them. // Note that we don't have xpcom initialized yet, so we can't use the // thread manager for this. Instead, we use pthreads directly. struct AutoAttachJavaThread { AutoAttachJavaThread() { attached = mozilla_AndroidBridge_SetMainThread((void*)pthread_self()); Loading @@ -72,8 +77,8 @@ struct AutoAttachJavaThread { bool attached; }; static void* GeckoStart(void *data) extern "C" NS_EXPORT void GeckoStart(void *data, const nsXREAppData *appData) { #ifdef MOZ_CRASHREPORTER const struct mapping_info *info = getLibraryMapping(); Loading @@ -86,11 +91,11 @@ GeckoStart(void *data) AutoAttachJavaThread attacher; if (!attacher.attached) return 0; return; if (!data) { LOG("Failed to get arguments for GeckoStart\n"); return 0; return; } nsTArray<char *> targs; Loading @@ -101,7 +106,7 @@ GeckoStart(void *data) } targs.AppendElement(static_cast<char *>(nsnull)); int result = XRE_main(targs.Length() - 1, targs.Elements(), &sAppData); int result = XRE_main(targs.Length() - 1, targs.Elements(), appData); if (result) LOG("XRE_main returned %d", result); Loading @@ -110,26 +115,5 @@ GeckoStart(void *data) free(targs[0]); nsMemory::Free(data); return 0; } extern "C" NS_EXPORT void JNICALL Java_org_mozilla_gecko_GeckoAppShell_nativeRun(JNIEnv *jenv, jclass jc, jstring jargs) { // We need to put Gecko on a even more separate thread, because // otherwise this JNI method never returns; this leads to problems // with local references overrunning the local refs table, among // other things, since GC can't ever run on them. // Note that we don't have xpcom initialized yet, so we can't use the // thread manager for this. Instead, we use pthreads directly. nsAutoString wargs; int len = jenv->GetStringLength(jargs); wargs.SetLength(jenv->GetStringLength(jargs)); jenv->GetStringRegion(jargs, 0, len, wargs.BeginWriting()); char *args = ToNewUTF8String(wargs); GeckoStart(args); return; }