Bug 1359659 - Ensure the complete pinned state is sent from the UI thread to the compositor r=jchen
authorRandall Barker <rbarker@mozilla.com>
Tue, 25 Apr 2017 19:26:08 -0700
changeset 403169 774240b19c633c7035f8d5fe92d33965fd6cedb3
parent 403168 e1eb2550cb111e242ded6a12d6e50731fcefcbf6
child 403170 3f1bc119c9e47de3f5ba6ecde4bc48a8243b710f
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)
reviewersjchen
bugs1359659
milestone55.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 1359659 - Ensure the complete pinned state is sent from the UI thread to the compositor r=jchen MozReview-Commit-ID: GXRtfDZ8R17
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/DynamicToolbarAnimator.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/DynamicToolbarAnimator.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/DynamicToolbarAnimator.java
@@ -25,33 +25,33 @@ public class DynamicToolbarAnimator {
         DISABLED(0),
         RELAYOUT(1),
         ACTION_MODE(2),
         FULL_SCREEN(3),
         CARET_DRAG(4),
         PAGE_LOADING(5),
         CUSTOM_TAB(6);
 
-        public final int mValue;
-        PinReason(final int value) {
-            mValue = value;
+        public final int value;
+        PinReason(final int aValue) {
+            value = aValue;
         }
     }
 
     public interface MetricsListener {
         public void onMetricsChanged(ImmutableViewportMetrics viewport);
     }
 
     public interface ToolbarChromeProxy {
         public Bitmap getBitmapOfToolbarChrome();
         public boolean isToolbarChromeVisible();
         public void toggleToolbarChrome(boolean aShow);
     }
 
-    private final Set<PinReason> pinFlags = Collections.synchronizedSet(EnumSet.noneOf(PinReason.class));
+    private final Set<PinReason> mPinFlags = Collections.synchronizedSet(EnumSet.noneOf(PinReason.class));
 
     private final GeckoLayerClient mTarget;
     private LayerView.Compositor mCompositor;
     private final List<MetricsListener> mListeners;
     private ToolbarChromeProxy mToolbarChromeProxy;
     private int mMaxToolbarHeight;
     private boolean mCompositorControllerOpen;
 
@@ -98,32 +98,32 @@ public class DynamicToolbarAnimator {
         }
         return 0;
     }
 
     /**
      * If true, scroll changes will not affect translation.
      */
     public boolean isPinned() {
-        return !pinFlags.isEmpty();
+        return !mPinFlags.isEmpty();
     }
 
     public boolean isPinnedBy(PinReason reason) {
-        return pinFlags.contains(reason);
+        return mPinFlags.contains(reason);
     }
 
     public void setPinned(boolean pinned, PinReason reason) {
-        if ((mCompositor != null) && (pinned != pinFlags.contains(reason))) {
-             mCompositor.setPinned(pinned, reason.mValue);
+        if ((mCompositor != null) && (pinned != mPinFlags.contains(reason))) {
+             mCompositor.setPinned(pinned, reason.value);
         }
 
         if (pinned) {
-            pinFlags.add(reason);
+            mPinFlags.add(reason);
         } else {
-            pinFlags.remove(reason);
+            mPinFlags.remove(reason);
         }
     }
 
     public void showToolbar(boolean immediately) {
         if (mCompositor != null) {
             mCompositor.sendToolbarAnimatorMessage(immediately ?
                 LayerView.REQUEST_SHOW_TOOLBAR_IMMEDIATELY : LayerView.REQUEST_SHOW_TOOLBAR_ANIMATED);
         }
@@ -155,18 +155,18 @@ public class DynamicToolbarAnimator {
     private void dumpStateToCompositor() {
         if ((mCompositor != null) && mCompositorControllerOpen) {
             mCompositor.setMaxToolbarHeight(mMaxToolbarHeight);
             if ((mToolbarChromeProxy != null) && mToolbarChromeProxy.isToolbarChromeVisible()) {
                 mCompositor.sendToolbarAnimatorMessage(LayerView.REQUEST_SHOW_TOOLBAR_IMMEDIATELY);
             } else {
                 mCompositor.sendToolbarAnimatorMessage(LayerView.REQUEST_HIDE_TOOLBAR_IMMEDIATELY);
             }
-            for (PinReason reason : pinFlags) {
-              mCompositor.setPinned(true, reason.mValue);
+            for (PinReason reason : PinReason.values()) {
+              mCompositor.setPinned(mPinFlags.contains(reason), reason.value);
             }
         } else if ((mCompositor != null) && !mCompositorControllerOpen) {
             // Ask the UiCompositorControllerChild if it is open since the open message can
             // sometimes be sent to a different instance of the LayerView such as when
             // Fennec is being used in custom tabs.
             mCompositor.sendToolbarAnimatorMessage(LayerView.IS_COMPOSITOR_CONTROLLER_OPEN);
         }
     }