Bug 860879 - Make GeckoAppShell.processNextNativeEvent waitable; r=blassey

This commit is contained in:
Jim Chen 2013-05-09 21:48:00 -04:00
parent a5fbb68769
commit ba21dd4081
5 changed files with 8 additions and 8 deletions

View File

@ -212,7 +212,7 @@ public class ActivityHandlerHelper {
try {
while (null == (filePickerResult = mFilePickerResult.poll(1, TimeUnit.MILLISECONDS))) {
GeckoAppShell.processNextNativeEvent();
GeckoAppShell.processNextNativeEvent(false);
}
} catch (InterruptedException e) {
Log.e(LOGTAG, "showing file picker failed: ", e);

View File

@ -212,7 +212,7 @@ public class GeckoAppShell
sendEventToGecko(GeckoEvent.createVisitedEvent(uri));
}
public static native void processNextNativeEvent();
public static native void processNextNativeEvent(boolean mayWait);
public static native void notifyBatteryChange(double aLevel, boolean aCharging, double aRemainingTime);

View File

@ -289,7 +289,7 @@ public class PromptService implements OnClickListener, OnCancelListener, OnItemC
String result = null;
try {
while (null == (result = mPromptQueue.poll(1, TimeUnit.MILLISECONDS))) {
GeckoAppShell.processNextNativeEvent();
GeckoAppShell.processNextNativeEvent(false);
}
} catch (InterruptedException e) {
}

View File

@ -191,16 +191,16 @@ Java_org_mozilla_gecko_GeckoAppShell_reportJavaCrash(JNIEnv * arg0, jclass arg1,
#ifdef JNI_STUBS
typedef void (*Java_org_mozilla_gecko_GeckoAppShell_processNextNativeEvent_t)(JNIEnv *, jclass);
typedef void (*Java_org_mozilla_gecko_GeckoAppShell_processNextNativeEvent_t)(JNIEnv *, jclass, jboolean);
static Java_org_mozilla_gecko_GeckoAppShell_processNextNativeEvent_t f_Java_org_mozilla_gecko_GeckoAppShell_processNextNativeEvent;
extern "C" NS_EXPORT void JNICALL
Java_org_mozilla_gecko_GeckoAppShell_processNextNativeEvent(JNIEnv * arg0, jclass arg1) {
Java_org_mozilla_gecko_GeckoAppShell_processNextNativeEvent(JNIEnv * arg0, jclass arg1, jboolean arg2) {
if (!f_Java_org_mozilla_gecko_GeckoAppShell_processNextNativeEvent) {
arg0->ThrowNew(arg0->FindClass("java/lang/UnsupportedOperationException"),
"JNI Function called before it was loaded");
return ;
}
f_Java_org_mozilla_gecko_GeckoAppShell_processNextNativeEvent(arg0, arg1);
f_Java_org_mozilla_gecko_GeckoAppShell_processNextNativeEvent(arg0, arg1, arg2);
}
#endif

View File

@ -68,11 +68,11 @@ Java_org_mozilla_gecko_GeckoAppShell_notifyGeckoOfEvent(JNIEnv *jenv, jclass jc,
}
NS_EXPORT void JNICALL
Java_org_mozilla_gecko_GeckoAppShell_processNextNativeEvent(JNIEnv *jenv, jclass)
Java_org_mozilla_gecko_GeckoAppShell_processNextNativeEvent(JNIEnv *jenv, jclass, jboolean mayWait)
{
// poke the appshell
if (nsAppShell::gAppShell)
nsAppShell::gAppShell->ProcessNextNativeEvent(false);
nsAppShell::gAppShell->ProcessNextNativeEvent(mayWait != JNI_FALSE);
}
NS_EXPORT void JNICALL