Bug 776702 - Remove unnecessary BitmapDrawable instance creation. r=cpeterson

This commit is contained in:
Kartikaya Gupta 2012-07-24 13:31:51 -04:00
parent 916691bb6f
commit 3064ab13f0

View File

@ -43,7 +43,7 @@ public final class Tab {
private int mFaviconSize; private int mFaviconSize;
private JSONObject mIdentityData; private JSONObject mIdentityData;
private boolean mReaderEnabled; private boolean mReaderEnabled;
private Drawable mThumbnail; private BitmapDrawable mThumbnail;
private int mHistoryIndex; private int mHistoryIndex;
private int mHistorySize; private int mHistorySize;
private int mParentId; private int mParentId;
@ -191,10 +191,9 @@ public final class Tab {
public void run() { public void run() {
if (b != null) { if (b != null) {
try { try {
if (mState == Tab.STATE_SUCCESS)
saveThumbnailToDB(new BitmapDrawable(b));
mThumbnail = new BitmapDrawable(b); mThumbnail = new BitmapDrawable(b);
if (mState == Tab.STATE_SUCCESS)
saveThumbnailToDB();
} catch (OutOfMemoryError oom) { } catch (OutOfMemoryError oom) {
Log.e(LOGTAG, "Unable to create/scale bitmap", oom); Log.e(LOGTAG, "Unable to create/scale bitmap", oom);
mThumbnail = null; mThumbnail = null;
@ -589,13 +588,13 @@ public final class Tab {
} }
} }
private void saveThumbnailToDB(BitmapDrawable thumbnail) { private void saveThumbnailToDB() {
try { try {
String url = getURL(); String url = getURL();
if (url == null) if (url == null)
return; return;
BrowserDB.updateThumbnailForUrl(mContentResolver, url, thumbnail); BrowserDB.updateThumbnailForUrl(mContentResolver, url, mThumbnail);
} catch (Exception e) { } catch (Exception e) {
// ignore // ignore
} }