no bug - make quit work r=dougt

This commit is contained in:
Brad Lassey 2011-10-19 16:31:31 -04:00
parent e0494f5b98
commit 8f858b54f3
4 changed files with 15 additions and 1 deletions

View File

@ -406,7 +406,8 @@ abstract public class GeckoApp
Log.i(LOG_FILE_NAME, "pleaseKillMe");
if (surfaceView != null)
surfaceView.saveLast(true);
System.exit(0);
GeckoAppShell.nativeQuit();
finish();
}
void handleLocationChange(final int tabId, final String uri) {

View File

@ -110,6 +110,7 @@ public class GeckoAppShell
// Initialization methods
public static native void nativeInit();
public static native void nativeRun(String args);
public static native void nativeQuit();
// helper methods
public static native void setSurfaceView(GeckoSurfaceView sv);

View File

@ -230,6 +230,7 @@ Java_org_mozilla_gecko_GeckoAppShell_ ## name(JNIEnv *jenv, jclass jc, type1 one
SHELL_WRAPPER0(nativeInit)
SHELL_WRAPPER1(nativeRun, jstring)
SHELL_WRAPPER0(nativeQuit)
SHELL_WRAPPER1(notifyGeckoOfEvent, jobject)
SHELL_WRAPPER0(processNextNativeEvent)
SHELL_WRAPPER1(setSurfaceView, jobject)
@ -635,6 +636,7 @@ loadLibs(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(nativeQuit);
GETFUNC(notifyGeckoOfEvent);
GETFUNC(processNextNativeEvent);
GETFUNC(setSurfaceView);

View File

@ -54,6 +54,8 @@
#include "AndroidBridge.h"
#include "APKOpen.h"
#include "nsExceptionHandler.h"
#include "nsIAppStartup.h"
#include "nsToolkitCompsCID.h"
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, MOZ_APP_NAME, args)
@ -168,3 +170,11 @@ Java_org_mozilla_gecko_GeckoAppShell_nativeRun(JNIEnv *jenv, jclass jc, jstring
GeckoStart(args);
}
extern "C" NS_EXPORT void JNICALL
Java_org_mozilla_gecko_GeckoAppShell_nativeQuit(JNIEnv*, jclass)
{
nsCOMPtr<nsIAppStartup> appStartup =
do_GetService(NS_APPSTARTUP_CONTRACTID);
if (appStartup)
appStartup->Quit(nsIAppStartup::eAttemptQuit);
}