summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/BrowserSettings.java
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2011-07-25 11:36:17 -0700
committerJohn Reck <jreck@google.com>2011-07-25 13:59:38 -0700
commitcadae72b6309303bc7b22e85181222b73e176c32 (patch)
treea33394121bd6c3553f9dc4a6d3dca04a914f4604 /src/com/android/browser/BrowserSettings.java
parent420d149566e19f1663db69420375b6dd1f0acd6f (diff)
downloadpackages_apps_Browser-cadae72b6309303bc7b22e85181222b73e176c32.zip
packages_apps_Browser-cadae72b6309303bc7b22e85181222b73e176c32.tar.gz
packages_apps_Browser-cadae72b6309303bc7b22e85181222b73e176c32.tar.bz2
Switch to a background thread pool
Bug: 5019676 Use a shared thread pool Eliminate some unnecessary use of AsyncTask (which has extra overhead compared to using a thread pool) Change-Id: I01d6c84816a9c9705216c8fdb8ed8c990265626a
Diffstat (limited to 'src/com/android/browser/BrowserSettings.java')
-rw-r--r--src/com/android/browser/BrowserSettings.java21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java
index 2023ee6..8461d30 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -22,7 +22,6 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Build;
-import android.os.Looper;
import android.os.Message;
import android.preference.PreferenceManager;
import android.provider.Browser;
@@ -104,10 +103,6 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
private AutofillHandler mAutofillHandler;
private WeakHashMap<WebSettings, String> mCustomUserAgents;
private static boolean sInitialized = false;
- // Looper shared between some lightweight background operations
- // Specifically, this is created on the thread that initializes browser settings
- // and is then reused by CrashRecoveryHandler
- private Looper mBackgroundLooper;
// Cached values
private int mPageCacheCapacity = 1;
@@ -134,7 +129,7 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
mCustomUserAgents = new WeakHashMap<WebSettings, String>();
mPrefs.registerOnSharedPreferenceChangeListener(this);
mAutofillHandler.asyncLoadFromDb();
- new Thread(mSetupAndLoop, "BackgroundLooper").start();
+ BackgroundHandler.execute(mSetup);
}
public void setController(Controller controller) {
@@ -146,11 +141,6 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
}
}
- public Looper getBackgroundLooper() {
- requireInitialization();
- return mBackgroundLooper;
- }
-
public void startManagingSettings(WebSettings settings) {
synchronized (mManagedSettings) {
syncStaticSettings(settings);
@@ -159,7 +149,7 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
}
}
- private Runnable mSetupAndLoop = new Runnable() {
+ private Runnable mSetup = new Runnable() {
@Override
public void run() {
@@ -208,13 +198,10 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
BrowserProvider.getClientId(mContext.getContentResolver()));
}
- Looper.prepare();
- mBackgroundLooper = Looper.myLooper();
synchronized (BrowserSettings.class) {
sInitialized = true;
BrowserSettings.class.notifyAll();
}
- Looper.loop();
}
};
@@ -525,6 +512,10 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
return (percent - 100) / TEXT_ZOOM_STEP + TEXT_ZOOM_START_VAL;
}
+ public SharedPreferences getPreferences() {
+ return mPrefs;
+ }
+
// -----------------------------
// getter/setters for accessibility_preferences.xml
// -----------------------------