Bug 1116615 - Remove unneeded UI thread Runnable from GeckoMenuItem updater r=rnewman
authorMark Finkle <mfinkle@mozilla.com>
Wed, 31 Dec 2014 01:37:54 -0500
changeset 247557 4a7b2b24738a75a4d0a06f28a7cf9473f6295157
parent 247556 73b35d5c99166acf16a751d3f70f4f9ad1c76f7a
child 247558 be87311dbf3707cdaed3ded558dc87b096fc2868
child 247596 355be9b24453e69c64f8b35900cd170af777fc0d
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman
bugs1116615
milestone37.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 1116615 - Remove unneeded UI thread Runnable from GeckoMenuItem updater r=rnewman
mobile/android/base/menu/GeckoMenu.java
--- a/mobile/android/base/menu/GeckoMenu.java
+++ b/mobile/android/base/menu/GeckoMenu.java
@@ -512,34 +512,26 @@ public class GeckoMenu extends ListView
             final View actionView;
             if (item.getActionEnum() == GeckoMenuItem.SHOW_AS_ACTION_ALWAYS) {
                 actionView = mPrimaryActionItems.get(item);
             } else {
                 actionView = mSecondaryActionItems.get(item);
             }
 
             if (actionView != null) {
-                // The update could be coming from the background thread.
-                // Post a runnable on the UI thread of the view for it to update.
-                final GeckoMenuItem menuItem = item;
-                actionView.post(new Runnable() {
-                    @Override
-                    public void run() {
-                        if (menuItem.isVisible()) {
-                            actionView.setVisibility(View.VISIBLE);
-                            if (actionView instanceof MenuItemActionBar) {
-                                ((MenuItemActionBar) actionView).initialize(menuItem);
-                            } else {
-                                ((MenuItemActionView) actionView).initialize(menuItem);
-                            }
-                        } else {
-                            actionView.setVisibility(View.GONE);
-                        }
+                if (item.isVisible()) {
+                    actionView.setVisibility(View.VISIBLE);
+                    if (actionView instanceof MenuItemActionBar) {
+                        ((MenuItemActionBar) actionView).initialize(item);
+                    } else {
+                        ((MenuItemActionView) actionView).initialize(item);
                     }
-                });
+                } else {
+                    actionView.setVisibility(View.GONE);
+                }
             }
         } else {
             mAdapter.notifyDataSetChanged();
         }
     }
 
     @Override
     public void onItemClick(AdapterView<?> parent, View view, int position, long id) {