Bug 1260243 - Call GeckoThread.onPause/onResume in GeckoService; r=snorp

Inform Gecko of the Android process lifecycle by calling
GeckoThread.onPause and onResume, so that Gecko is more likely to be in
a consistent state if Android kills our process.
This commit is contained in:
Jim Chen 2016-04-05 21:43:41 -04:00
Родитель 2bb3a5b2e1
Коммит a8db6b0407
1 изменённых файлов: 8 добавлений и 2 удалений

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

@ -88,6 +88,7 @@ public class GeckoService extends Service {
public void onCreate() {
GeckoAppShell.ensureCrashHandling();
GeckoAppShell.setApplicationContext(getApplicationContext());
GeckoThread.onResume();
super.onCreate();
@ -98,8 +99,13 @@ public class GeckoService extends Service {
@Override // Service
public void onDestroy() {
// TODO: Make sure Gecko is in a somewhat idle state
// because our process could be killed at anytime.
GeckoThread.onPause();
// We want to block here if we can, so we don't get killed when Gecko is in the
// middle of handling onPause().
if (GeckoThread.isStateAtLeast(GeckoThread.State.PROFILE_READY)) {
GeckoThread.waitOnGecko();
}
if (DEBUG) {
Log.d(LOGTAG, "Destroyed");