Bug 735230 - Part 3: Use the new compositor pause/resume events. r=kats
authorAli Juma <ajuma@mozilla.com>
Wed, 28 Mar 2012 18:00:38 -0400
changeset 90569 9435818930fabd03b6449f3124b9f25be2811eee
parent 90568 5303cc81321448cd5cea7b0dc60cf5a5a4bdc9ae
child 90570 842d96e5f3afb4f0cb76621c8d3c4da3f4f9a6d1
push id22366
push usermak77@bonardo.net
push dateThu, 29 Mar 2012 15:38:30 +0000
treeherdermozilla-central@ff3521bc6559 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs735230
milestone14.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 735230 - Part 3: Use the new compositor pause/resume events. r=kats
mobile/android/base/gfx/GeckoLayerClient.java
--- a/mobile/android/base/gfx/GeckoLayerClient.java
+++ b/mobile/android/base/gfx/GeckoLayerClient.java
@@ -391,28 +391,38 @@ public class GeckoLayerClient implements
 
     /** Implementation of FlexibleGLSurfaceView.Listener */
     public void renderRequested() {
         GeckoAppShell.scheduleComposite();
     }
 
     /** Implementation of FlexibleGLSurfaceView.Listener */
     public void compositionPauseRequested() {
-        GeckoAppShell.schedulePauseComposition();
+        // We need to coordinate with Gecko when pausing composition, to ensure
+        // that Gecko never executes a draw event while the compositor is paused.
+        GeckoAppShell.sendEventToGecko(GeckoEvent.createCompositorPauseEvent());
     }
 
     /** Implementation of FlexibleGLSurfaceView.Listener */
     public void compositionResumeRequested() {
+        // Asking Gecko to resume the compositor takes too long (see
+        // https://bugzilla.mozilla.org/show_bug.cgi?id=735230#c23), so we
+        // resume the compositor directly. We still need to inform Gecko about
+        // the compositor resuming, so that Gecko knows that it can now draw.
         GeckoAppShell.scheduleResumeComposition();
+        GeckoAppShell.sendEventToGecko(GeckoEvent.createCompositorResumeEvent());
     }
 
     /** Implementation of FlexibleGLSurfaceView.Listener */
     public void surfaceChanged(int width, int height) {
-        compositionPauseRequested();
         mLayerController.setViewportSize(new FloatSize(width, height));
+
+        // We need to make this call even when the compositor isn't currently
+        // paused (e.g. during an orientation change), to make the compositor
+        // aware of the changed surface.
         compositionResumeRequested();
         renderRequested();
     }
 
     /** Used by robocop for testing purposes. Not for production use! This is called via reflection by robocop. */
     public void setDrawListener(DrawListener listener) {
         mDrawListener = listener;
     }