Backed out changeset ffeffef36f34 (bug 1344892) on request of developer for issues with Android reftests. r=backout on a CLOSED TREE
authorSebastian Hengst <archaeopteryx@coole-files.de>
Fri, 10 Mar 2017 21:53:00 +0100
changeset 395293 0a986886241cb0aa08ca8a6b2ef9fd2bca6c0042
parent 395292 063241ee73a56c21197031e0b3bbc5d35d9128ac
child 395294 cc5e2abed8085d2947079ed773cba45af01403ce
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1344892
milestone55.0a1
backs outffeffef36f34c0cf16aed96e2f8bb06af07a2a4c
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset ffeffef36f34 (bug 1344892) on request of developer for issues with Android reftests. r=backout on a CLOSED TREE
build/annotationProcessors/AnnotationInfo.java
mobile/android/base/java/org/mozilla/gecko/ZoomedView.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/AndroidGamepadManager.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/EventDispatcher.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/annotation/WrapForJNI.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/LayerView.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/NativePanZoomController.java
widget/android/EventDispatcher.cpp
widget/android/GeneratedJNIWrappers.h
widget/android/fennec/FennecJNIWrappers.h
widget/android/jni/Natives.h
widget/android/jni/Utils.cpp
widget/android/jni/Utils.h
widget/android/nsAppShell.cpp
widget/android/nsWindow.cpp
--- a/build/annotationProcessors/AnnotationInfo.java
+++ b/build/annotationProcessors/AnnotationInfo.java
@@ -25,17 +25,16 @@ public class AnnotationInfo {
 
         String nativeValue() {
             return "mozilla::jni::CallingThread::" + name();
         }
     }
 
     public enum DispatchTarget {
         GECKO,
-        GECKO_PRIORITY,
         PROXY,
         CURRENT;
 
         String nativeValue() {
             return "mozilla::jni::DispatchTarget::" + name();
         }
     }
 
--- a/mobile/android/base/java/org/mozilla/gecko/ZoomedView.java
+++ b/mobile/android/base/java/org/mozilla/gecko/ZoomedView.java
@@ -775,17 +775,17 @@ public class ZoomedView extends FrameLay
     private boolean isRendering() {
         return (startTimeReRender != 0);
     }
 
     private boolean renderFrequencyTooHigh() {
         return ((System.nanoTime() - lastStartTimeReRender) < MINIMUM_DELAY_BETWEEN_TWO_RENDER_CALLS_NS);
     }
 
-    @WrapForJNI(dispatchTo = "gecko_priority")
+    @WrapForJNI(dispatchTo = "gecko")
     private static native void requestZoomedViewData(ByteBuffer buffer, int tabId,
                                                      int xPos, int yPos, int width,
                                                      int height, float scale);
 
     @Override
     public void requestZoomedViewRender() {
         if (stopUpdateView) {
             return;
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/AndroidGamepadManager.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/AndroidGamepadManager.java
@@ -124,21 +124,21 @@ public class AndroidGamepadManager {
                                             MotionEvent.AXIS_GAS};
                 } else {
                     triggerAxes = null;
                 }
             }
         }
     }
 
-    @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko_priority")
+    @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
     private static native void onGamepadChange(int id, boolean added);
-    @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko_priority")
+    @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
     private static native void onButtonChange(int id, int button, boolean pressed, float value);
-    @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko_priority")
+    @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
     private static native void onAxisChange(int id, boolean[] valid, float[] values);
 
     private static boolean sStarted;
     private static final SparseArray<Gamepad> sGamepads = new SparseArray<>();
     private static final SparseArray<List<KeyEvent>> sPendingGamepads = new SparseArray<>();
     private static InputManager.InputDeviceListener sListener;
     private static Timer sPollTimer;
 
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/EventDispatcher.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/EventDispatcher.java
@@ -73,17 +73,17 @@ public final class EventDispatcher exten
     /* package */ EventDispatcher(final NativeQueue.StateHolder stateHolder) {
         mStateHolder = stateHolder;
     }
 
     private boolean isReadyForDispatchingToGecko() {
         return mStateHolder.isReady();
     }
 
-    @WrapForJNI(dispatchTo = "gecko_priority") @Override // JNIObject
+    @WrapForJNI(dispatchTo = "gecko") @Override // JNIObject
     protected native void disposeNative();
 
     @WrapForJNI private static final int DETACHED = 0;
     @WrapForJNI private static final int ATTACHED = 1;
     @WrapForJNI private static final int REATTACHING = 2;
 
     @WrapForJNI(calledFrom = "gecko")
     private synchronized void setAttachedToGecko(final int state) {
@@ -356,17 +356,17 @@ public final class EventDispatcher exten
         }
 
         @WrapForJNI(dispatchTo = "proxy") @Override // EventCallback
         public native void sendSuccess(Object response);
 
         @WrapForJNI(dispatchTo = "proxy") @Override // EventCallback
         public native void sendError(Object response);
 
-        @WrapForJNI(dispatchTo = "gecko_priority") @Override // Object
+        @WrapForJNI(dispatchTo = "gecko") @Override // Object
         protected native void finalize();
     }
 
     private static class JavaCallbackDelegate implements EventCallback {
         private final Thread originalThread = Thread.currentThread();
         private final EventCallback callback;
 
         public static EventCallback wrap(final EventCallback callback) {
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
@@ -249,17 +249,17 @@ public class GeckoAppShell
     public static LayerView getLayerView() {
         return sLayerView;
     }
 
     // Synchronously notify a Gecko observer; must be called from Gecko thread.
     @WrapForJNI(calledFrom = "gecko")
     public static native void syncNotifyObservers(String topic, String data);
 
-    @WrapForJNI(stubName = "NotifyObservers", dispatchTo = "gecko")
+    @WrapForJNI(stubName = "NotifyObservers", dispatchTo = "proxy")
     private static native void nativeNotifyObservers(String topic, String data);
 
     @RobocopTarget
     public static void notifyObservers(final String topic, final String data) {
         notifyObservers(topic, data, GeckoThread.State.RUNNING);
     }
 
     public static void notifyObservers(final String topic, final String data, final GeckoThread.State state) {
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/annotation/WrapForJNI.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/annotation/WrapForJNI.java
@@ -25,36 +25,27 @@ public @interface WrapForJNI {
     /**
      * Optional parameter specifying the name of the generated method stub. If omitted,
      * the capitalized name of the Java method will be used.
      */
     String stubName() default "";
 
     /**
      * Action to take if member access returns an exception.
-     * - "abort" will cause a crash if there is a pending exception.
-     * - "ignore" will not handle any pending exceptions; it is then the caller's
-     *   responsibility to handle exceptions.
-     * - "nsresult" will clear any pending exceptions and return an error code; not
-     *   supported for native methods.
+     * One of "abort", "ignore", or "nsresult". "nsresult" is not supported for native
+     * methods.
      */
     String exceptionMode() default "abort";
 
     /**
      * The thread that the method will be called from.
      * One of "any", "gecko", or "ui". Not supported for fields.
      */
     String calledFrom() default "any";
 
     /**
      * The thread that the method call will be dispatched to.
-     * - "current" indicates no dispatching; only supported value for fields,
-     *   constructors, non-native methods, and non-void native methods.
-     * - "gecko" indicates dispatching to the Gecko XPCOM (nsThread) event queue.
-     * - "gecko_priority" indicates dispatching to the Gecko widget
-     *   (nsAppShell) event queue; in most cases, events in the widget event
-     *   queue (aka native event queue) are favored over events in the XPCOM
-     *   event queue.
-     * - "proxy" indicates dispatching to a proxy function as a function object; see
-     *   widget/jni/Natives.h.
+     * One of "current", "gecko", or "proxy". Not supported for non-native methods,
+     * fields, and constructors. Only void-return methods are supported for anything other
+     * than current thread.
      */
     String dispatchTo() default "current";
 }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/LayerView.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/LayerView.java
@@ -67,25 +67,25 @@ public class LayerView extends FrameLayo
     /* This is written by the Gecko thread and the UI thread, and read by the UI thread. */
     @WrapForJNI(stubName = "CompositorCreated", calledFrom = "ui")
     /* package */ volatile boolean mCompositorCreated;
 
     private class Compositor extends JNIObject {
         public Compositor() {
         }
 
-        @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko_priority")
+        @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
         @Override protected native void disposeNative();
 
         // Gecko thread sets its Java instances; does not block UI thread.
-        @WrapForJNI(calledFrom = "any", dispatchTo = "gecko_priority")
+        @WrapForJNI(calledFrom = "any", dispatchTo = "gecko")
         /* package */ native void attachToJava(GeckoLayerClient layerClient,
                                                NativePanZoomController npzc);
 
-        @WrapForJNI(calledFrom = "any", dispatchTo = "gecko_priority")
+        @WrapForJNI(calledFrom = "any", dispatchTo = "gecko")
         /* package */ native void onSizeChanged(int windowWidth, int windowHeight,
                                                 int screenWidth, int screenHeight);
 
         // Gecko thread creates compositor; blocks UI thread.
         @WrapForJNI(calledFrom = "ui", dispatchTo = "proxy")
         /* package */ native void createCompositor(int width, int height, Object surface);
 
         // Gecko thread pauses compositor; blocks UI thread.
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/NativePanZoomController.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/NativePanZoomController.java
@@ -215,17 +215,17 @@ class NativePanZoomController extends JN
         disposeNative();
     }
 
     @Override
     public void attach() {
         mDestroyed = false;
     }
 
-    @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko_priority") @Override // JNIObject
+    @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko") @Override // JNIObject
     protected native void disposeNative();
 
     @Override
     public void setOverscrollHandler(final Overscroll handler) {
         mOverscroll = handler;
     }
 
     @WrapForJNI(stubName = "SetIsLongpressEnabled") // Called from test thread.
--- a/widget/android/EventDispatcher.cpp
+++ b/widget/android/EventDispatcher.cpp
@@ -645,17 +645,17 @@ public:
 
     template<typename Functor>
     static void OnNativeCall(Functor&& aCall)
     {
         if (NS_IsMainThread()) {
             // Invoke callbacks synchronously if we're already on Gecko thread.
             return aCall();
         }
-        NS_DispatchToMainThread(NS_NewRunnableFunction(Move(aCall)));
+        nsAppShell::PostEvent(Move(aCall));
     }
 
     static void Finalize(const CallbackDelegate::LocalRef& aInstance)
     {
         DisposeNative(aInstance);
     }
 
     NativeCallbackDelegateSupport(nsIAndroidEventCallback* callback,
--- a/widget/android/GeneratedJNIWrappers.h
+++ b/widget/android/GeneratedJNIWrappers.h
@@ -61,17 +61,17 @@ public:
         static constexpr char signature[] =
                 "(I[Z[F)V";
         static const bool isStatic = true;
         static const mozilla::jni::ExceptionMode exceptionMode =
                 mozilla::jni::ExceptionMode::ABORT;
         static const mozilla::jni::CallingThread callingThread =
                 mozilla::jni::CallingThread::UI;
         static const mozilla::jni::DispatchTarget dispatchTarget =
-                mozilla::jni::DispatchTarget::GECKO_PRIORITY;
+                mozilla::jni::DispatchTarget::GECKO;
     };
 
     struct OnButtonChange_t {
         typedef AndroidGamepadManager Owner;
         typedef void ReturnType;
         typedef void SetterType;
         typedef mozilla::jni::Args<
                 int32_t,
@@ -82,17 +82,17 @@ public:
         static constexpr char signature[] =
                 "(IIZF)V";
         static const bool isStatic = true;
         static const mozilla::jni::ExceptionMode exceptionMode =
                 mozilla::jni::ExceptionMode::ABORT;
         static const mozilla::jni::CallingThread callingThread =
                 mozilla::jni::CallingThread::UI;
         static const mozilla::jni::DispatchTarget dispatchTarget =
-                mozilla::jni::DispatchTarget::GECKO_PRIORITY;
+                mozilla::jni::DispatchTarget::GECKO;
     };
 
     struct OnGamepadAdded_t {
         typedef AndroidGamepadManager Owner;
         typedef void ReturnType;
         typedef void SetterType;
         typedef mozilla::jni::Args<
                 int32_t,
@@ -122,17 +122,17 @@ public:
         static constexpr char signature[] =
                 "(IZ)V";
         static const bool isStatic = true;
         static const mozilla::jni::ExceptionMode exceptionMode =
                 mozilla::jni::ExceptionMode::ABORT;
         static const mozilla::jni::CallingThread callingThread =
                 mozilla::jni::CallingThread::UI;
         static const mozilla::jni::DispatchTarget dispatchTarget =
-                mozilla::jni::DispatchTarget::GECKO_PRIORITY;
+                mozilla::jni::DispatchTarget::GECKO;
     };
 
     struct Start_t {
         typedef AndroidGamepadManager Owner;
         typedef void ReturnType;
         typedef void SetterType;
         typedef mozilla::jni::Args<> Args;
         static constexpr char name[] = "start";
@@ -234,17 +234,17 @@ public:
         static constexpr char signature[] =
                 "()V";
         static const bool isStatic = false;
         static const mozilla::jni::ExceptionMode exceptionMode =
                 mozilla::jni::ExceptionMode::ABORT;
         static const mozilla::jni::CallingThread callingThread =
                 mozilla::jni::CallingThread::ANY;
         static const mozilla::jni::DispatchTarget dispatchTarget =
-                mozilla::jni::DispatchTarget::GECKO_PRIORITY;
+                mozilla::jni::DispatchTarget::GECKO;
     };
 
     struct GetInstance_t {
         typedef EventDispatcher Owner;
         typedef EventDispatcher::LocalRef ReturnType;
         typedef EventDispatcher::Param SetterType;
         typedef mozilla::jni::Args<> Args;
         static constexpr char name[] = "getInstance";
@@ -346,17 +346,17 @@ public:
         static constexpr char signature[] =
                 "()V";
         static const bool isStatic = false;
         static const mozilla::jni::ExceptionMode exceptionMode =
                 mozilla::jni::ExceptionMode::ABORT;
         static const mozilla::jni::CallingThread callingThread =
                 mozilla::jni::CallingThread::ANY;
         static const mozilla::jni::DispatchTarget dispatchTarget =
-                mozilla::jni::DispatchTarget::GECKO_PRIORITY;
+                mozilla::jni::DispatchTarget::GECKO;
     };
 
     struct SendError_t {
         typedef NativeCallbackDelegate Owner;
         typedef void ReturnType;
         typedef void SetterType;
         typedef mozilla::jni::Args<
                 mozilla::jni::Object::Param> Args;
@@ -1495,17 +1495,17 @@ public:
         static constexpr char signature[] =
                 "(Ljava/lang/String;Ljava/lang/String;)V";
         static const bool isStatic = true;
         static const mozilla::jni::ExceptionMode exceptionMode =
                 mozilla::jni::ExceptionMode::ABORT;
         static const mozilla::jni::CallingThread callingThread =
                 mozilla::jni::CallingThread::ANY;
         static const mozilla::jni::DispatchTarget dispatchTarget =
-                mozilla::jni::DispatchTarget::GECKO;
+                mozilla::jni::DispatchTarget::PROXY;
     };
 
     struct NotifyAlertListener_t {
         typedef GeckoAppShell Owner;
         typedef void ReturnType;
         typedef void SetterType;
         typedef mozilla::jni::Args<
                 mozilla::jni::String::Param,
@@ -3851,17 +3851,17 @@ public:
         static constexpr char signature[] =
                 "(Lorg/mozilla/gecko/gfx/GeckoLayerClient;Lorg/mozilla/gecko/gfx/NativePanZoomController;)V";
         static const bool isStatic = false;
         static const mozilla::jni::ExceptionMode exceptionMode =
                 mozilla::jni::ExceptionMode::ABORT;
         static const mozilla::jni::CallingThread callingThread =
                 mozilla::jni::CallingThread::ANY;
         static const mozilla::jni::DispatchTarget dispatchTarget =
-                mozilla::jni::DispatchTarget::GECKO_PRIORITY;
+                mozilla::jni::DispatchTarget::GECKO;
     };
 
     struct CreateCompositor_t {
         typedef Compositor Owner;
         typedef void ReturnType;
         typedef void SetterType;
         typedef mozilla::jni::Args<
                 int32_t,
@@ -3907,17 +3907,17 @@ public:
         static constexpr char signature[] =
                 "()V";
         static const bool isStatic = false;
         static const mozilla::jni::ExceptionMode exceptionMode =
                 mozilla::jni::ExceptionMode::ABORT;
         static const mozilla::jni::CallingThread callingThread =
                 mozilla::jni::CallingThread::UI;
         static const mozilla::jni::DispatchTarget dispatchTarget =
-                mozilla::jni::DispatchTarget::GECKO_PRIORITY;
+                mozilla::jni::DispatchTarget::GECKO;
     };
 
     struct OnSizeChanged_t {
         typedef Compositor Owner;
         typedef void ReturnType;
         typedef void SetterType;
         typedef mozilla::jni::Args<
                 int32_t,
@@ -3928,17 +3928,17 @@ public:
         static constexpr char signature[] =
                 "(IIII)V";
         static const bool isStatic = false;
         static const mozilla::jni::ExceptionMode exceptionMode =
                 mozilla::jni::ExceptionMode::ABORT;
         static const mozilla::jni::CallingThread callingThread =
                 mozilla::jni::CallingThread::ANY;
         static const mozilla::jni::DispatchTarget dispatchTarget =
-                mozilla::jni::DispatchTarget::GECKO_PRIORITY;
+                mozilla::jni::DispatchTarget::GECKO;
     };
 
     struct Reattach_t {
         typedef Compositor Owner;
         typedef void ReturnType;
         typedef void SetterType;
         typedef mozilla::jni::Args<> Args;
         static constexpr char name[] = "reattach";
@@ -4069,17 +4069,17 @@ public:
         static constexpr char signature[] =
                 "()V";
         static const bool isStatic = false;
         static const mozilla::jni::ExceptionMode exceptionMode =
                 mozilla::jni::ExceptionMode::ABORT;
         static const mozilla::jni::CallingThread callingThread =
                 mozilla::jni::CallingThread::UI;
         static const mozilla::jni::DispatchTarget dispatchTarget =
-                mozilla::jni::DispatchTarget::GECKO_PRIORITY;
+                mozilla::jni::DispatchTarget::GECKO;
     };
 
     struct HandleMotionEvent_t {
         typedef NativePanZoomController Owner;
         typedef bool ReturnType;
         typedef bool SetterType;
         typedef mozilla::jni::Args<
                 int32_t,
--- a/widget/android/fennec/FennecJNIWrappers.h
+++ b/widget/android/fennec/FennecJNIWrappers.h
@@ -590,17 +590,17 @@ public:
         static constexpr char signature[] =
                 "(Ljava/nio/ByteBuffer;IIIIIF)V";
         static const bool isStatic = true;
         static const mozilla::jni::ExceptionMode exceptionMode =
                 mozilla::jni::ExceptionMode::ABORT;
         static const mozilla::jni::CallingThread callingThread =
                 mozilla::jni::CallingThread::ANY;
         static const mozilla::jni::DispatchTarget dispatchTarget =
-                mozilla::jni::DispatchTarget::GECKO_PRIORITY;
+                mozilla::jni::DispatchTarget::GECKO;
     };
 
     static const mozilla::jni::CallingThread callingThread =
             mozilla::jni::CallingThread::ANY;
 
     template<class Impl> class Natives;
 };
 
--- a/widget/android/jni/Natives.h
+++ b/widget/android/jni/Natives.h
@@ -1,15 +1,13 @@
 #ifndef mozilla_jni_Natives_h__
 #define mozilla_jni_Natives_h__
 
 #include <jni.h>
 
-#include "nsThreadUtils.h"
-
 #include "mozilla/IndexSequence.h"
 #include "mozilla/Move.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/Tuple.h"
 #include "mozilla/TypeTraits.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/WeakPtr.h"
 #include "mozilla/Unused.h"
@@ -501,50 +499,32 @@ struct Dispatcher
         Impl::OnNativeCall(ProxyNativeCall<
                 Impl, typename Traits::Owner, IsStatic,
                 HasThisArg, Args...>(Forward<ProxyArgs>(args)...));
     }
 
     template<class Traits, bool IsStatic = Traits::isStatic,
              typename ThisArg, typename... ProxyArgs>
     static typename EnableIf<
-            Traits::dispatchTarget == DispatchTarget::GECKO_PRIORITY, void>::Type
-    Run(ThisArg thisArg, ProxyArgs&&... args)
-    {
-        // For a static method, do not forward the "this arg" (i.e. the class
-        // local ref) if the implementation does not request it. This saves us
-        // a pair of calls to add/delete global ref.
-        DispatchToGeckoPriorityQueue(MakeUnique<ProxyNativeCall<
-                Impl, typename Traits::Owner, IsStatic, HasThisArg,
-                Args...>>(HasThisArg || !IsStatic ? thisArg : nullptr,
-                          Forward<ProxyArgs>(args)...));
-    }
-
-    template<class Traits, bool IsStatic = Traits::isStatic,
-             typename ThisArg, typename... ProxyArgs>
-    static typename EnableIf<
             Traits::dispatchTarget == DispatchTarget::GECKO, void>::Type
     Run(ThisArg thisArg, ProxyArgs&&... args)
     {
         // For a static method, do not forward the "this arg" (i.e. the class
         // local ref) if the implementation does not request it. This saves us
         // a pair of calls to add/delete global ref.
-        NS_DispatchToMainThread(NS_NewRunnableFunction(ProxyNativeCall<
+        DispatchToGeckoThread(MakeUnique<ProxyNativeCall<
                 Impl, typename Traits::Owner, IsStatic, HasThisArg,
-                Args...>(HasThisArg || !IsStatic ? thisArg : nullptr,
-                          Forward<ProxyArgs>(args)...)));
+                Args...>>(HasThisArg || !IsStatic ? thisArg : nullptr,
+                          Forward<ProxyArgs>(args)...));
     }
 
     template<class Traits, bool IsStatic = false, typename... ProxyArgs>
     static typename EnableIf<
             Traits::dispatchTarget == DispatchTarget::CURRENT, void>::Type
-    Run(ProxyArgs&&... args)
-    {
-        MOZ_CRASH("Unreachable code");
-    }
+    Run(ProxyArgs&&... args) {}
 };
 
 } // namespace detail
 
 // Wrapper methods that convert arguments from the JNI types to the native
 // types, e.g. from jobject to jni::Object::Ref. For instance methods, the
 // wrapper methods also convert calls to calls on objects.
 //
--- a/widget/android/jni/Utils.cpp
+++ b/widget/android/jni/Utils.cpp
@@ -282,17 +282,17 @@ jclass GetClassRef(JNIEnv* aEnv, const c
             "Does the class require a newer API version? "
             "Or did ProGuard optimize away something it shouldn't have?",
             aClassName);
     aEnv->ExceptionDescribe();
     MOZ_CRASH("Cannot find JNI class");
     return nullptr;
 }
 
-void DispatchToGeckoPriorityQueue(UniquePtr<AbstractCall>&& aCall)
+void DispatchToGeckoThread(UniquePtr<AbstractCall>&& aCall)
 {
     class AbstractCallEvent : public nsAppShell::Event
     {
         UniquePtr<AbstractCall> mCall;
 
     public:
         AbstractCallEvent(UniquePtr<AbstractCall>&& aCall)
             : mCall(Move(aCall))
--- a/widget/android/jni/Utils.h
+++ b/widget/android/jni/Utils.h
@@ -45,24 +45,19 @@ enum class CallingThread
 enum class DispatchTarget
 {
     // Call happens synchronously on the calling thread (default).
     CURRENT,
     // Call happens synchronously on the calling thread, but the call is
     // wrapped in a function object and is passed thru UsesNativeCallProxy.
     // Method must return void.
     PROXY,
-    // Call is dispatched asynchronously on the Gecko thread to the XPCOM
-    // (nsThread) event queue. Method must return void.
+    // Call is dispatched asynchronously on the Gecko thread. Method must
+    // return void.
     GECKO,
-    // Call is dispatched asynchronously on the Gecko thread to the widget
-    // (nsAppShell) event queue. In most cases, events in the widget event
-    // queue (aka native event queue) are favored over events in the XPCOM
-    // event queue. Method must return void.
-    GECKO_PRIORITY,
 };
 
 
 extern JNIEnv* sGeckoThreadEnv;
 
 inline bool IsAvailable()
 {
     return !!sGeckoThreadEnv;
@@ -133,17 +128,17 @@ void SetNativeHandle(JNIEnv* env, jobjec
 jclass GetClassRef(JNIEnv* aEnv, const char* aClassName);
 
 struct AbstractCall
 {
     virtual ~AbstractCall() {}
     virtual void operator()() = 0;
 };
 
-void DispatchToGeckoPriorityQueue(UniquePtr<AbstractCall>&& aCall);
+void DispatchToGeckoThread(UniquePtr<AbstractCall>&& aCall);
 
 /**
  * Returns whether Gecko is running in a Fennec environment, as determined by
  * the presence of the GeckoApp class.
  */
 bool IsFennec();
 
 } // jni
--- a/widget/android/nsAppShell.cpp
+++ b/widget/android/nsAppShell.cpp
@@ -257,16 +257,23 @@ public:
 
     static void SyncNotifyObservers(jni::String::Param aTopic,
                                     jni::String::Param aData)
     {
         MOZ_RELEASE_ASSERT(NS_IsMainThread());
         NotifyObservers(aTopic, aData);
     }
 
+    template<typename Functor>
+    static void OnNativeCall(Functor&& aCall)
+    {
+        MOZ_ASSERT(aCall.IsTarget(&NotifyObservers));
+        NS_DispatchToMainThread(NS_NewRunnableFunction(mozilla::Move(aCall)));
+    }
+
     static void NotifyObservers(jni::String::Param aTopic,
                                 jni::String::Param aData)
     {
         MOZ_ASSERT(NS_IsMainThread());
         MOZ_ASSERT(aTopic);
 
         nsCOMPtr<nsIObserverService> obsServ = services::GetObserverService();
         if (!obsServ) {
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -847,18 +847,16 @@ public:
     static void OnNativeCall(Functor&& aCall)
     {
         if (aCall.IsTarget(&LayerViewSupport::CreateCompositor)) {
             // This call is blocking.
             nsAppShell::SyncRunEvent(nsAppShell::LambdaEvent<Functor>(
                     mozilla::Move(aCall)), &LayerViewEvent::MakeEvent);
             return;
         }
-
-        MOZ_CRASH("Unexpected call");
     }
 
     static LayerViewSupport*
     FromNative(const LayerView::Compositor::LocalRef& instance)
     {
         return GetNative(instance);
     }