Bug 789887 - Avoid creating unnecessary AboutHomeRunnables. r=lucasr

This commit is contained in:
Margaret Leibovic 2012-09-24 14:48:21 -07:00
Родитель 92e087e715
Коммит d887b504a1
1 изменённых файлов: 12 добавлений и 3 удалений

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

@ -51,6 +51,7 @@ abstract public class BrowserApp extends GeckoApp
public static BrowserToolbar mBrowserToolbar;
private AboutHomeContent mAboutHomeContent;
private boolean mAboutHomeShowing;
static Vector<MenuItem> sAddonMenuItems = new Vector<MenuItem>();
@ -584,17 +585,25 @@ abstract public class BrowserApp extends GeckoApp
mAboutHomeContent.update(EnumSet.of(AboutHomeContent.UpdateFlags.TOP_SITES));
}
public void showAboutHome() {
private void showAboutHome() {
if (mAboutHomeShowing)
return;
mAboutHomeShowing = true;
Runnable r = new AboutHomeRunnable(true);
mMainHandler.postAtFrontOfQueue(r);
}
public void hideAboutHome() {
private void hideAboutHome() {
if (!mAboutHomeShowing)
return;
mAboutHomeShowing = false;
Runnable r = new AboutHomeRunnable(false);
mMainHandler.postAtFrontOfQueue(r);
}
public class AboutHomeRunnable implements Runnable {
private class AboutHomeRunnable implements Runnable {
boolean mShow;
AboutHomeRunnable(boolean show) {
mShow = show;