Bug 1122302 - Small perf improvement in ActivityChooserModel. r=rnewman
authorMichael Comella <michael.l.comella@gmail.com>
Thu, 12 Mar 2015 16:02:00 -0700
changeset 233741 4dc8b8d5ab5f3df865c03e59977fd3c596fa4628
parent 233740 b27486859693d6f72513a1566f06e2871af7b153
child 233742 428351f601623639543f26358ebadbecd28efd49
push id28423
push userphilringnalda@gmail.com
push dateMon, 16 Mar 2015 02:35:36 +0000
treeherdermozilla-central@436686833af0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman
bugs1122302
milestone39.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 1122302 - Small perf improvement in ActivityChooserModel. r=rnewman Take a function call out of a loop.
mobile/android/base/widget/ActivityChooserModel.java
--- a/mobile/android/base/widget/ActivityChooserModel.java
+++ b/mobile/android/base/widget/ActivityChooserModel.java
@@ -755,30 +755,31 @@ public class ActivityChooserModel extend
                     .queryIntentActivities(mIntent, 0);
             final int resolveInfoCount = resolveInfos.size();
 
             /**
              * Mozilla: Temporary variables to prevent performance degradation in the loop.
              */
             final PackageManager packageManager = mContext.getPackageManager();
             final String channelToRemoveLabel = mContext.getResources().getString(R.string.overlay_share_label);
+            final String shareDialogClassName = ShareDialog.class.getCanonicalName();
 
             for (int i = 0; i < resolveInfoCount; i++) {
                 ResolveInfo resolveInfo = resolveInfos.get(i);
 
                 /**
                  * Mozilla: We want "Add to Firefox" to appear differently inside of Firefox than
                  * from external applications - override the name and icon here.
                  *
                  * Do not display the menu item if there are no devices to share to.
                  *
                  * Note: we check both the class name and the label to ensure we only change the
                  * label of the current channel.
                  */
-                if (ShareDialog.class.getCanonicalName().equals(resolveInfo.activityInfo.name) &&
+                if (shareDialogClassName.equals(resolveInfo.activityInfo.name) &&
                         channelToRemoveLabel.equals(resolveInfo.loadLabel(packageManager))) {
                     // Don't add the menu item if there are no devices to share to.
                     if (getOtherSyncedClientCount() <= 0) {
                         continue;
                     }
 
                     resolveInfo.labelRes = R.string.overlay_share_send_other;
                     resolveInfo.icon = R.drawable.share_plane;