mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 889881 - Refactor and add a Gecko handler to ThreadUtils; r=blassey
This commit is contained in:
parent
7bda4c9e6a
commit
aa3cbe8305
@ -1435,7 +1435,6 @@ abstract public class GeckoApp
|
||||
|
||||
if (!mIsRestoringActivity) {
|
||||
sGeckoThread = new GeckoThread(intent, passedUri);
|
||||
ThreadUtils.setGeckoThread(sGeckoThread);
|
||||
}
|
||||
if (!ACTION_DEBUG.equals(action) &&
|
||||
GeckoThread.checkAndSetLaunchState(GeckoThread.LaunchState.Launching, GeckoThread.LaunchState.Launched)) {
|
||||
|
@ -293,7 +293,6 @@ public class GeckoAppShell
|
||||
}
|
||||
|
||||
public static void runGecko(String apkPath, String args, String url, String type) {
|
||||
Looper.prepare();
|
||||
|
||||
// run gecko -- it will spawn its own thread
|
||||
GeckoAppShell.nativeInit();
|
||||
|
@ -7,6 +7,7 @@ package org.mozilla.gecko;
|
||||
|
||||
import org.mozilla.gecko.mozglue.GeckoLoader;
|
||||
import org.mozilla.gecko.util.GeckoEventListener;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
@ -14,6 +15,8 @@ import android.content.Intent;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
import android.app.Activity;
|
||||
@ -100,6 +103,9 @@ public class GeckoThread extends Thread implements GeckoEventListener {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Looper.prepare();
|
||||
ThreadUtils.setGeckoThread(this, new Handler());
|
||||
|
||||
String path = initGeckoEnvironment();
|
||||
|
||||
Log.w(LOGTAG, "zerdatime " + SystemClock.uptimeMillis() + " - runGecko");
|
||||
|
@ -54,7 +54,6 @@ public class GeckoView extends LayerView
|
||||
GeckoAppShell.registerEventListener("Gecko:Ready", this);
|
||||
|
||||
sGeckoThread = new GeckoThread(intent, url);
|
||||
ThreadUtils.setGeckoThread(sGeckoThread);
|
||||
ThreadUtils.setUiThread(Thread.currentThread(), new Handler());
|
||||
initializeView(GeckoAppShell.getEventDispatcher());
|
||||
if (GeckoThread.checkAndSetLaunchState(GeckoThread.LaunchState.Launching, GeckoThread.LaunchState.Launched)) {
|
||||
|
@ -18,6 +18,7 @@ public final class ThreadUtils {
|
||||
private static Thread sBackgroundThread;
|
||||
|
||||
private static Handler sUiHandler;
|
||||
private static Handler sGeckoHandler;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public static class UiThreadBlockedException extends RuntimeException {
|
||||
@ -55,8 +56,9 @@ public final class ThreadUtils {
|
||||
sUiHandler = handler;
|
||||
}
|
||||
|
||||
public static void setGeckoThread(Thread thread) {
|
||||
public static void setGeckoThread(Thread thread, Handler handler) {
|
||||
sGeckoThread = thread;
|
||||
sGeckoHandler = handler;
|
||||
}
|
||||
|
||||
public static void setBackgroundThread(Thread thread) {
|
||||
@ -79,6 +81,10 @@ public final class ThreadUtils {
|
||||
return sGeckoThread;
|
||||
}
|
||||
|
||||
public static Handler getGeckoHandler() {
|
||||
return sGeckoHandler;
|
||||
}
|
||||
|
||||
public static Thread getBackgroundThread() {
|
||||
return sBackgroundThread;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user