Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(683)

Unified Diff: android_webview/java/src/org/chromium/android_webview/HttpAuthDatabase.java

Issue 522943003: [Android] Fix findbugs errors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed threading issues in HttpAuthDatabase constructor Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: android_webview/java/src/org/chromium/android_webview/HttpAuthDatabase.java
diff --git a/android_webview/java/src/org/chromium/android_webview/HttpAuthDatabase.java b/android_webview/java/src/org/chromium/android_webview/HttpAuthDatabase.java
index 8102e1fc959bde04f4dd025010a35b4b53cd9fe9..c8da1340bd978f14b37150e61df6da12fcd4b554 100644
--- a/android_webview/java/src/org/chromium/android_webview/HttpAuthDatabase.java
+++ b/android_webview/java/src/org/chromium/android_webview/HttpAuthDatabase.java
@@ -55,21 +55,26 @@ public class HttpAuthDatabase {
private final Object mInitializedLock = new Object();
/**
- * Create an instance of HttpAuthDatabase for the named file, and kick-off background
- * initialization of that database.
+ * Creates and returns an instance of HttpAuthDatabase for the named file, and kicks-off
+ * background initialization of that database.
*
* @param context the Context to use for opening the database
* @param databaseFile Name of the file to be initialized.
*/
- public HttpAuthDatabase(final Context context, final String databaseFile) {
+ public static HttpAuthDatabase newInstance(final Context context, final String databaseFile) {
+ final HttpAuthDatabase httpAuthDatabase = new HttpAuthDatabase();
new Thread() {
@Override
public void run() {
- initOnBackgroundThread(context, databaseFile);
+ httpAuthDatabase.initOnBackgroundThread(context, databaseFile);
}
}.start();
+ return httpAuthDatabase;
}
+ // Prevent instantiation. Callers should use newInstance().
+ private HttpAuthDatabase() {}
+
/**
* Initializes the databases and notifies any callers waiting on waitForInit.
*

Powered by Google App Engine
This is Rietveld 408576698