Bug 1235246 - Only prioritize compositor events in GLController; r=snorp
authorJim Chen <nchen@mozilla.com>
Wed, 06 Jan 2016 21:33:17 -0500
changeset 278903 bd5bcf2006485886acdddf9b3b65c5c913f8e54e
parent 278902 014d0b989aceaad86c46e9425218b9d6c0f3e7b2
child 278904 6691a39fbeb8b9bfa3c552566c5c8ecd7e50e390
push id29860
push usercbook@mozilla.com
push dateThu, 07 Jan 2016 10:51:20 +0000
treeherdermozilla-central@e0bcd16e1d4b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1235246
milestone46.0a1
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
Bug 1235246 - Only prioritize compositor events in GLController; r=snorp Only three GLController events -- CreateCompositor, PauseCompositor, and OnResumedCompositor should be prioritized through GLControllerEvent. The other GLController events should follow the normal event queue ordering to prevent race conditions.
widget/android/nsWindow.cpp
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -434,27 +434,34 @@ public:
                 &GLControllerSupport::SyncResumeResizeCompositor)) {
             // This call is synchronous. Perform the original call using a copy
             // of the lambda. Then redirect the original lambda to
             // OnResumedCompositor, to be run on the Gecko thread. We use
             // Functor instead of our own lambda so that Functor can handle
             // object lifetimes for us.
             (Functor(aCall))();
             aCall.SetTarget(&GLControllerSupport::OnResumedCompositor);
+            nsAppShell::PostEvent(
+                    mozilla::MakeUnique<GLControllerEvent>(
+                    mozilla::MakeUnique<GeckoViewSupport::WindowEvent<Functor>>(
+                    mozilla::Move(aCall))));
+            return;
 
         } else if (aCall.IsTarget(
                 &GLControllerSupport::SyncInvalidateAndScheduleComposite)) {
             // This call is synchronous.
             return aCall();
         }
 
+        // GLControllerEvent (i.e. prioritized event) applies to
+        // CreateCompositor, PauseCompositor, and OnResumedCompositor. For all
+        // other events, use regular WindowEvent.
         nsAppShell::PostEvent(
-                mozilla::MakeUnique<GLControllerEvent>(
                 mozilla::MakeUnique<GeckoViewSupport::WindowEvent<Functor>>(
-                mozilla::Move(aCall))));
+                mozilla::Move(aCall)));
     }
 
     GLControllerSupport(nsWindow* aWindow,
                         const GLController::LocalRef& aInstance)
         : window(*aWindow)
         , mGLController(aInstance)
         , mCompositorPaused(true)
     {