diff options
| author | John Reck <jreck@google.com> | 2011-07-25 13:55:44 -0700 |
|---|---|---|
| committer | John Reck <jreck@google.com> | 2011-07-26 10:37:02 -0700 |
| commit | af262e703038106aef2e5187d120617836ffe9ce (patch) | |
| tree | 4a3e1a7b6d96d7fe18c7a7234c1ff561f00b5ece /src/com/android/browser/Controller.java | |
| parent | a229f22f88a0ae7a5e6601744c1b37795117bb4f (diff) | |
Remove obsolete usage of WebIconDatabase
Bug: 5019676
Removes some other legacy code
Change-Id: I766d9d6f7805b5619a9769e6d72ae2f4c363d3ed
Diffstat (limited to 'src/com/android/browser/Controller.java')
| -rw-r--r-- | src/com/android/browser/Controller.java | 47 |
1 files changed, 10 insertions, 37 deletions
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java index 4c05688b..92682c1e 100644 --- a/src/com/android/browser/Controller.java +++ b/src/com/android/browser/Controller.java @@ -260,7 +260,7 @@ public class Controller new SystemAllowGeolocationOrigins(mActivity.getApplicationContext()); mSystemAllowGeolocationOrigins.start(); - retainIconsOnStartup(); + openIconDatabase(); mSimulateActionBarOverlayMode = !BrowserActivity.isTablet(mActivity); } @@ -418,43 +418,17 @@ public class Controller return mTabControl.getTabs(); } - // Open the icon database and retain all the icons for visited sites. - // This is done on a background thread so as not to stall startup. - private void retainIconsOnStartup() { - // WebIconDatabase needs to be retrieved on the UI thread so that if - // it has not been created successfully yet the Handler is started on the - // UI thread. - Runnable task = new RetainIconsOnStartupTask( - mActivity, WebIconDatabase.getInstance()); - BackgroundHandler.execute(task); - } - - private static class RetainIconsOnStartupTask implements Runnable { - private WebIconDatabase mDb; - private Context mContext; - - public RetainIconsOnStartupTask(Context context, WebIconDatabase db) { - mDb = db; - mContext = context; - } + // Open the icon database. + private void openIconDatabase() { + // We have to call getInstance on the UI thread + final WebIconDatabase instance = WebIconDatabase.getInstance(); + BackgroundHandler.execute(new Runnable() { - @Override - public void run() { - mDb.open(mContext.getDir("icons", 0).getPath()); - Cursor c = null; - try { - c = Browser.getAllBookmarks(mContext.getContentResolver()); - int urlIndex = c.getColumnIndex(Browser.BookmarkColumns.URL); - while (c.moveToNext()) { - String url = c.getString(urlIndex); - mDb.retainIconForPageUrl(url); - } - } catch (Throwable e) { - Log.e(LOGTAG, "retainIconsOnStartup", e); - } finally { - if (c != null) c.close(); + @Override + public void run() { + instance.open(mActivity.getDir("icons", 0).getPath()); } - } + }); } private void startHandler() { @@ -941,7 +915,6 @@ public class Controller return; } DataController.getInstance(mActivity).updateVisitedHistory(url); - WebIconDatabase.getInstance().retainIconForPageUrl(url); if (!mActivityPaused) { // Since we clear the state in onPause, don't backup the current // state if we are already paused |
