bug 721216 - Bitmap compression on main thread causes the tab strip to take a long time to appear r=pcwalton

This commit is contained in:
Brad Lassey 2012-01-25 18:36:03 -05:00
Родитель 13e6881fbb
Коммит 04a39875f5
3 изменённых файлов: 12 добавлений и 9 удалений

Просмотреть файл

@ -594,11 +594,10 @@ abstract public class GeckoApp
}
}
void getAndProcessThumbnailForTab(Tab tab) {
Bitmap bitmap = null;
if (Tabs.getInstance().isSelectedTab(tab))
bitmap = mSoftwareLayerClient.getBitmap();
void getAndProcessThumbnailForTab(final Tab tab) {
final Bitmap bitmap = Tabs.getInstance().isSelectedTab(tab) ?
mSoftwareLayerClient.getBitmap() : null;
if (bitmap != null) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 0, bos);

Просмотреть файл

@ -288,8 +288,12 @@ public class Tabs implements GeckoEventListener {
}
public void refreshThumbnails() {
Iterator<Tab> iterator = tabs.values().iterator();
while (iterator.hasNext())
GeckoApp.mAppContext.getAndProcessThumbnailForTab(iterator.next());
GeckoAppShell.getHandler().post(new Runnable() {
public void run() {
Iterator<Tab> iterator = tabs.values().iterator();
while (iterator.hasNext())
GeckoApp.mAppContext.getAndProcessThumbnailForTab(iterator.next());
}
});
}
}

Просмотреть файл

@ -91,8 +91,8 @@ public class TabsTray extends Activity implements GeckoApp.OnTabsChangedListener
}
});
Tabs.getInstance().refreshThumbnails();
GeckoApp.registerOnTabsChangedListener(this);
Tabs.getInstance().refreshThumbnails();
onTabsChanged(null);
}