Bug 1254797 - Pre: fix variable name being negation of value. r=rnewman, a=ritu
authorAndrzej Hunt <andrzej@ahunt.org>
Wed, 09 Mar 2016 20:10:34 -0800
changeset 325613 87e35794cf880fc8561ae2c076dbcf3064c4de1b
parent 325612 e8c5bba77ee526b19c21731905093f76cd0868db
child 325614 d6ec426e0c96a9811881b1a0d5b43fc0707ea7a9
push id1128
push userjlund@mozilla.com
push dateWed, 01 Jun 2016 01:31:59 +0000
treeherdermozilla-release@fe0d30de989d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman, ritu
bugs1254797
milestone47.0a2
Bug 1254797 - Pre: fix variable name being negation of value. r=rnewman, a=ritu This variable was renamed to be positive instead of negative but the value/usage wasn't adapted. MozReview-Commit-ID: H1DeZMmvTXC
mobile/android/base/java/org/mozilla/gecko/db/BrowserProvider.java
--- a/mobile/android/base/java/org/mozilla/gecko/db/BrowserProvider.java
+++ b/mobile/android/base/java/org/mozilla/gecko/db/BrowserProvider.java
@@ -756,28 +756,28 @@ public class BrowserProvider extends Sha
         // We could access the underlying data here, however SuggestedSites also performs filtering on the suggested
         // sites list, which means we'd need to process the lists within SuggestedSites in any case. If we're doing
         // that processing, there is little real between us using a MatrixCursor, or a Map (or List) instead of the
         // MatrixCursor.
         final Cursor suggestedSitesCursor = suggestedSites.get(suggestedGridLimit);
 
         String[] suggestedSiteArgs = new String[0];
 
-        boolean hasProcessedAnySuggestedSites = true;
+        boolean hasProcessedAnySuggestedSites = false;
 
         final int idColumnIndex = suggestedSitesCursor.getColumnIndexOrThrow(Bookmarks._ID);
         final int urlColumnIndex = suggestedSitesCursor.getColumnIndexOrThrow(Bookmarks.URL);
         final int titleColumnIndex = suggestedSitesCursor.getColumnIndexOrThrow(Bookmarks.TITLE);
 
         while (suggestedSitesCursor.moveToNext()) {
             // We'll be using this as a subquery, hence we need to avoid the preceding UNION ALL
-            if (!hasProcessedAnySuggestedSites) {
+            if (hasProcessedAnySuggestedSites) {
                 suggestedSitesBuilder.append(" UNION ALL");
             } else {
-                hasProcessedAnySuggestedSites = false;
+                hasProcessedAnySuggestedSites = true;
             }
             suggestedSitesBuilder.append(" SELECT" +
                                          " ? AS " + Bookmarks._ID + "," +
                                          " ? AS " + Bookmarks.URL + "," +
                                          " ? AS " + Bookmarks.TITLE);
 
             suggestedSiteArgs = DBUtils.appendSelectionArgs(suggestedSiteArgs,
                                                             new String[] {
@@ -807,17 +807,17 @@ public class BrowserProvider extends Sha
                        TopSites.TYPE_TOP + " AS " + TopSites.TYPE +
                        " FROM " + Combined.VIEW_NAME +
                        " WHERE " + ignoreForTopSitesWhereClause +
                        " ORDER BY " + BrowserContract.getFrecencySortOrder(true, false) +
                        " LIMIT " + totalLimit,
 
                        ignoreForTopSitesArgs);
 
-            if (!hasProcessedAnySuggestedSites) {
+            if (hasProcessedAnySuggestedSites) {
                 db.execSQL("INSERT INTO " + TABLE_TOPSITES +
                            // We need to LIMIT _after_ selecting the relevant suggested sites, which requires us to
                            // use an additional internal subquery, since we cannot LIMIT a subquery that is part of UNION ALL.
                            // Hence the weird SELECT * FROM (SELECT ...relevant suggested sites... LIMIT ?)
                            " SELECT * FROM (SELECT " +
                            Bookmarks._ID + ", " +
                            Bookmarks._ID + " AS " + Combined.BOOKMARK_ID + ", " +
                            " -1 AS " + Combined.HISTORY_ID + ", " +