Bug 604090 - Notify java wrapper when we're ready to take events, r=blassey a=blocking-fennec

This commit is contained in:
Michael Wu 2010-10-25 20:10:07 -07:00
parent cb81958a1b
commit d5ff124d9a
6 changed files with 23 additions and 22 deletions

View File

@ -136,8 +136,6 @@ class GeckoAppShell
// Tell Gecko where the target surface view is for rendering
GeckoAppShell.setSurfaceView(GeckoApp.surfaceView);
sGeckoRunning = true;
// First argument is the .apk path
String combinedArgs = apkPath + " -omnijar " + apkPath;
if (args != null)
@ -146,10 +144,6 @@ class GeckoAppShell
combinedArgs += " " + url;
// and go
GeckoAppShell.nativeRun(combinedArgs);
if (gPendingResize != null) {
notifyGeckoOfEvent(gPendingResize);
gPendingResize = null;
}
}
private static GeckoEvent mLastDrawEvent;
@ -337,6 +331,15 @@ class GeckoAppShell
}
}
static void onAppShellReady()
{
sGeckoRunning = true;
if (gPendingResize != null) {
notifyGeckoOfEvent(gPendingResize);
gPendingResize = null;
}
}
static void onXreExit() {
sGeckoRunning = false;
Log.i("GeckoAppJava", "XRE exited");

View File

@ -123,8 +123,6 @@ class GeckoSurfaceView
GeckoAppShell.scheduleRedraw();
mSurfaceNeedsRedraw = false;
}
mSurfaceChanged = true;
} finally {
mSurfaceLock.unlock();
}
@ -192,8 +190,6 @@ class GeckoSurfaceView
Log.e("GeckoAppJava", "endDrawing with false mSurfaceValid");
return;
}
} catch (java.lang.IllegalArgumentException ex) {
mSurfaceChanged = true;
} finally {
mInDrawing = false;
@ -288,10 +284,6 @@ class GeckoSurfaceView
// Do we need to force a redraw on surfaceChanged?
boolean mSurfaceNeedsRedraw;
// Has this surface been changed? (That is,
// do we need to recreate buffers?)
boolean mSurfaceChanged;
// Are we actively between beginDrawing/endDrawing?
boolean mInDrawing;

View File

@ -103,6 +103,7 @@ AndroidBridge::Init(JNIEnv *jEnv,
jEnableLocation = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "enableLocation", "(Z)V");
jReturnIMEQueryResult = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "returnIMEQueryResult", "(Ljava/lang/String;II)V");
jScheduleRestart = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "scheduleRestart", "()V");
jNotifyAppShellReady = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "onAppShellReady", "()V");
jNotifyXreExit = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "onXreExit", "()V");
jGetHandlersForMimeType = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getHandlersForMimeType", "(Ljava/lang/String;Ljava/lang/String;)[Ljava/lang/String;");
jGetHandlersForProtocol = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getHandlersForProtocol", "(Ljava/lang/String;Ljava/lang/String;)[Ljava/lang/String;");
@ -248,6 +249,12 @@ AndroidBridge::ReturnIMEQueryResult(const PRUnichar *aResult, PRUint32 aLen,
jReturnIMEQueryResult, args);
}
void
AndroidBridge::NotifyAppShellReady()
{
mJNIEnv->CallStaticVoidMethod(mGeckoAppShellClass, jNotifyAppShellReady);
}
void
AndroidBridge::ScheduleRestart()
{

View File

@ -115,6 +115,8 @@ public:
void ReturnIMEQueryResult(const PRUnichar *aResult, PRUint32 aLen, int aSelStart, int aSelLen);
void NotifyAppShellReady();
void NotifyXreExit();
void ScheduleRestart();
@ -217,6 +219,7 @@ protected:
jmethodID jEnableAccelerometer;
jmethodID jEnableLocation;
jmethodID jReturnIMEQueryResult;
jmethodID jNotifyAppShellReady;
jmethodID jNotifyXreExit;
jmethodID jScheduleRestart;
jmethodID jGetOutstandingDrawEvents;

View File

@ -81,8 +81,6 @@ Java_org_mozilla_gecko_GeckoAppShell_notifyGeckoOfEvent(JNIEnv *jenv, jclass jc,
// poke the appshell
if (nsAppShell::gAppShell)
nsAppShell::gAppShell->PostEvent(new AndroidGeckoEvent(jenv, event));
else if (!nsAppShell::gEarlyEvent)
nsAppShell::gEarlyEvent = new AndroidGeckoEvent(jenv, event);
}
NS_EXPORT void JNICALL

View File

@ -74,7 +74,6 @@ nsAccelerometerSystem *gAccel = nsnull;
nsIGeolocationUpdate *gLocationCallback = nsnull;
nsAppShell *nsAppShell::gAppShell = nsnull;
AndroidGeckoEvent *nsAppShell::gEarlyEvent = nsnull;
nsAppShell::nsAppShell()
: mQueueLock(nsnull),
@ -83,10 +82,6 @@ nsAppShell::nsAppShell()
mNumDraws(0)
{
gAppShell = this;
if (gEarlyEvent) {
mEventQueue.AppendElement(gEarlyEvent);
gEarlyEvent = nsnull;
}
}
nsAppShell::~nsAppShell()
@ -116,7 +111,10 @@ nsAppShell::Init()
mObserversHash.Init();
return nsBaseAppShell::Init();
nsresult rv = nsBaseAppShell::Init();
if (AndroidBridge::Bridge())
AndroidBridge::Bridge()->NotifyAppShellReady();
return rv;
}