Bug 1298968 - Add comment explaining why TOPSITES is handled outside of switch r=sebastian
authorAndrzej Hunt <ahunt@mozilla.com>
Tue, 06 Sep 2016 10:06:58 -0700
changeset 312860 243fe9c65a048abe71545e206a8a7d05088dd1af
parent 312859 5c231de97dec73665c04a3300f44c448fa2c2b42
child 312861 dd2d29dbd7c5ac4af4540ca679658c0b1568ee7f
push id30663
push usercbook@mozilla.com
push dateWed, 07 Sep 2016 15:12:31 +0000
treeherdermozilla-central@3d0b41fdd93b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs1298968
milestone51.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 1298968 - Add comment explaining why TOPSITES is handled outside of switch r=sebastian MozReview-Commit-ID: BFvz2qTm4vL
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
@@ -1206,16 +1206,20 @@ public class BrowserProvider extends Sha
         return db.rawQuery(query, null);
     }
 
     @Override
     public Cursor query(Uri uri, String[] projection, String selection,
             String[] selectionArgs, String sortOrder) {
         final int match = URI_MATCHER.match(uri);
 
+        // Handle only queries requiring a writable DB connection here: most queries need only a readable
+        // connection, hence we can get a readable DB once, and then handle most queries within a switch.
+        // TopSites requires a writable connection (because of the temporary tables it uses), hence
+        // we handle that separately, i.e. before retrieving a readable connection.
         if (match == TOPSITES) {
             if (uri.getBooleanQueryParameter(BrowserContract.PARAM_TOPSITES_DISABLE_PINNED, false)) {
                 return getPlainTopSites(uri);
             } else {
                 return getTopSites(uri);
             }
         }