Bug 1411654 - Pre: Remove unused PerProfileDatabaseProvider. r=mcomella
authorNick Alexander <nalexander@mozilla.com>
Tue, 07 Nov 2017 20:18:56 -0800
changeset 453607 3dc3beab95f83b2f08ff9ff305fdd4b85cc05d9d
parent 453606 22a861db1573364916ab2c5b6d0c6321ba08ff55
child 453608 373c9a71d9451498462594b302b4fe2648431fef
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcomella
bugs1411654
milestone59.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 1411654 - Pre: Remove unused PerProfileDatabaseProvider. r=mcomella No idea what is going on with this hierarchy, but this isn't used and isn't helping anything. MozReview-Commit-ID: Ir3LxLYHR6M
mobile/android/app/lint.xml
mobile/android/base/java/org/mozilla/gecko/db/AbstractTransactionalProvider.java
mobile/android/base/java/org/mozilla/gecko/db/PerProfileDatabaseProvider.java
mobile/android/base/moz.build
--- a/mobile/android/app/lint.xml
+++ b/mobile/android/app/lint.xml
@@ -46,17 +46,16 @@
     <!-- Fixes are in progress but we would like to block future candidates.
          The ** in the path are wildcards. We need these wildcards to not change our code structure.
          See: http://stackoverflow.com/questions/43994420/what-path-is-the-issue-ignore-path-element-in-lint-xml-relative-to -->
     <issue id="NewApi" severity="error">
         <ignore path="**/mobile/android/base/java/org/mozilla/gecko/activitystream/ActivityStreamPreference.java"/>
         <ignore path="**/mobile/android/base/java/org/mozilla/gecko/dlc/DownloadContentTelemetry.java"/>
         <ignore path="**/mobile/android/base/java/org/mozilla/gecko/preferences/LocaleListPreference.java"/>
         <ignore path="**/mobile/android/base/java/org/mozilla/gecko/media/MediaControlService.java"/>
-        <ignore path="**/mobile/android/base/java/org/mozilla/gecko/db/PerProfileDatabaseProvider.java"/>
         <ignore path="**/mobile/android/base/java/org/mozilla/gecko/PrintHelper.java"/>
         <ignore path="**/mobile/android/base/java/org/mozilla/gecko/animation/PropertyAnimator.java"/>
         <ignore path="**/mobile/android/base/java/org/mozilla/gecko/RemotePresentationService.java"/>
         <ignore path="**/mobile/android/base/java/org/mozilla/gecko/db/SharedBrowserDatabaseProvider.java"/>
         <ignore path="**/mobile/android/base/java/org/mozilla/gecko/tabs/TabPanelBackButton.java"/>
         <ignore path="**/mobile/android/base/java/org/mozilla/gecko/toolbar/ToolbarEditText.java"/>
         <ignore path="**/mobile/android/base/java/org/mozilla/gecko/util/ViewUtil.java"/>
         <ignore path="**/mobile/android/base/java/org/mozilla/gecko/IntentHelper.java"/>
--- a/mobile/android/base/java/org/mozilla/gecko/db/AbstractTransactionalProvider.java
+++ b/mobile/android/base/java/org/mozilla/gecko/db/AbstractTransactionalProvider.java
@@ -37,18 +37,16 @@ import java.util.Arrays;
  * primarily to avoid the pattern of a transaction being begun, a read occurring,
  * and then a write being necessary. This lock upgrade can result in SQLITE_BUSY,
  * which we don't handle well. Better to avoid starting a transaction too soon!
  *
  * You are probably interested in some subclasses:
  *
  * * {@link AbstractPerProfileDatabaseProvider} provides a simple abstraction for
  *   querying databases that are stored in the user's profile directory.
- * * {@link PerProfileDatabaseProvider} is a simple version that only allows a
- *   single ContentProvider to access each per-profile database.
  * * {@link SharedBrowserDatabaseProvider} is an example of a per-profile provider
  *   that allows for multiple providers to safely work with the same databases.
  */
 @SuppressWarnings("javadoc")
 public abstract class AbstractTransactionalProvider extends ContentProvider {
     private static final String LOGTAG = "GeckoTransProvider";
 
     private static final boolean logDebug = Log.isLoggable(LOGTAG, Log.DEBUG);
@@ -129,17 +127,17 @@ public abstract class AbstractTransactio
             db.setTransactionSuccessful();
         }
     }
 
     /**
      * If we're not in a batch, but we are in a write transaction,
      * end it.
      *
-     * @see PerProfileDatabaseProvider#markWriteSuccessful(SQLiteDatabase)
+     * @see AbstractTransactionalProvider#markWriteSuccessful(SQLiteDatabase)
      */
     protected void endWrite(final SQLiteDatabase db) {
         if (isInBatch()) {
             trace("Not ending write: inside batch operation.");
             return;
         }
 
         if (db.inTransaction()) {
deleted file mode 100644
--- a/mobile/android/base/java/org/mozilla/gecko/db/PerProfileDatabaseProvider.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.gecko.db;
-
-import org.mozilla.gecko.AppConstants.Versions;
-import org.mozilla.gecko.db.PerProfileDatabases.DatabaseHelperFactory;
-
-import android.content.Context;
-import android.database.sqlite.SQLiteOpenHelper;
-
-/**
- * Abstract class containing methods needed to make a SQLite-based content
- * provider with a database helper of type T, where one database helper is
- * held per profile.
- */
-public abstract class PerProfileDatabaseProvider<T extends SQLiteOpenHelper> extends AbstractPerProfileDatabaseProvider {
-    private PerProfileDatabases<T> databases;
-
-    @Override
-    protected PerProfileDatabases<T> getDatabases() {
-        return databases;
-    }
-
-    protected abstract String getDatabaseName();
-
-    /**
-     * Creates and returns an instance of the appropriate DB helper.
-     *
-     * @param  context       to use to create the database helper
-     * @param  databasePath  path to the DB file
-     * @return               instance of the database helper
-     */
-    protected abstract T createDatabaseHelper(Context context, String databasePath);
-
-    @Override
-    public boolean onCreate() {
-        synchronized (this) {
-            databases = new PerProfileDatabases<T>(
-                getContext(), getDatabaseName(), new DatabaseHelperFactory<T>() {
-                    @Override
-                    public T makeDatabaseHelper(Context context, String databasePath) {
-                        final T helper = createDatabaseHelper(context, databasePath);
-                        if (Versions.feature16Plus) {
-                            helper.setWriteAheadLoggingEnabled(true);
-                        }
-                        return helper;
-                    }
-                });
-        }
-
-        return true;
-    }
-}
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -560,17 +560,16 @@ gbjar.sources += ['java/org/mozilla/geck
     'db/HomeProvider.java',
     'db/LocalBrowserDB.java',
     'db/LocalSearches.java',
     'db/LocalTabsAccessor.java',
     'db/LocalUrlAnnotations.java',
     'db/LocalURLMetadata.java',
     'db/LoginsProvider.java',
     'db/PasswordsProvider.java',
-    'db/PerProfileDatabaseProvider.java',
     'db/PerProfileDatabases.java',
     'db/RemoteClient.java',
     'db/RemoteTab.java',
     'db/Searches.java',
     'db/SearchHistoryProvider.java',
     'db/SharedBrowserDatabaseProvider.java',
     'db/SQLiteBridgeContentProvider.java',
     'db/SuggestedSites.java',