Bug 719494 - Closing tabs is too slow sometimes. r=mbrubeck

This commit is contained in:
Margaret Leibovic 2012-01-20 12:56:23 -08:00
parent f4ab175c7d
commit d28397a961
3 changed files with 12 additions and 21 deletions

View File

@ -914,10 +914,6 @@ abstract public class GeckoApp
Boolean selected = message.getBoolean("selected");
if (selected)
handleSelectTab(tab.getId());
} else if (event.equals("Tab:Closed")) {
Log.i(LOGTAG, "Destroyed a tab");
int tabId = message.getInt("tabID");
handleCloseTab(tabId);
} else if (event.equals("Tab:ScreenshotData")) {
int tabId = message.getInt("tabID");
Tab tab = Tabs.getInstance().getTab(tabId);
@ -1584,7 +1580,6 @@ abstract public class GeckoApp
GeckoAppShell.registerGeckoEventListener("Content:LoadError", GeckoApp.mAppContext);
GeckoAppShell.registerGeckoEventListener("onCameraCapture", GeckoApp.mAppContext);
GeckoAppShell.registerGeckoEventListener("Tab:Added", GeckoApp.mAppContext);
GeckoAppShell.registerGeckoEventListener("Tab:Closed", GeckoApp.mAppContext);
GeckoAppShell.registerGeckoEventListener("Tab:Selected", GeckoApp.mAppContext);
GeckoAppShell.registerGeckoEventListener("Tab:ScreenshotData", GeckoApp.mAppContext);
GeckoAppShell.registerGeckoEventListener("Doorhanger:Add", GeckoApp.mAppContext);
@ -1913,7 +1908,6 @@ abstract public class GeckoApp
GeckoAppShell.unregisterGeckoEventListener("Content:LoadError", GeckoApp.mAppContext);
GeckoAppShell.unregisterGeckoEventListener("onCameraCapture", GeckoApp.mAppContext);
GeckoAppShell.unregisterGeckoEventListener("Tab:Added", GeckoApp.mAppContext);
GeckoAppShell.unregisterGeckoEventListener("Tab:Closed", GeckoApp.mAppContext);
GeckoAppShell.unregisterGeckoEventListener("Tab:Selected", GeckoApp.mAppContext);
GeckoAppShell.unregisterGeckoEventListener("Tab:ScreenshotData", GeckoApp.mAppContext);
GeckoAppShell.unregisterGeckoEventListener("Doorhanger:Add", GeckoApp.mAppContext);

View File

@ -37,15 +37,16 @@
package org.mozilla.gecko;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.ContentResolver;
import android.graphics.drawable.*;
import android.util.Log;
import org.json.JSONObject;
import org.json.JSONException;
public class Tabs implements GeckoEventListener {
private static final String LOGTAG = "GeckoTabs";
@ -146,6 +147,8 @@ public class Tabs implements GeckoEventListener {
GeckoAppShell.sendEventToGecko(new GeckoEvent("Tab:Select", String.valueOf(nextTab.getId())));
GeckoAppShell.sendEventToGecko(new GeckoEvent("Tab:Close", String.valueOf(tab.getId())));
GeckoApp.mAppContext.handleCloseTab(tab.getId());
}
/** Return the tab that will be selected by default after this one is closed */

View File

@ -469,7 +469,9 @@ var BrowserApp = {
return newTab;
},
closeTab: function closeTab(aTab) {
// WARNING: Calling this will only update the state in BrowserApp. It will
// not close the tab in the Java UI.
_closeTab: function _closeTab(aTab) {
if (aTab == this.selectedTab)
this.selectedTab = null;
@ -847,7 +849,7 @@ var BrowserApp = {
} else if (aTopic == "Tab:Select") {
this.selectTab(this.getTabForId(parseInt(aData)));
} else if (aTopic == "Tab:Close") {
this.closeTab(this.getTabForId(parseInt(aData)));
this._closeTab(this.getTabForId(parseInt(aData)));
} else if (aTopic == "Tab:Screenshot") {
this.screenshotTab(aData);
} else if (aTopic == "Browser:Quit") {
@ -1427,14 +1429,6 @@ Tab.prototype = {
this.browser = null;
this.vbox = null;
this.documentIdForCurrentViewport = null;
let message = {
gecko: {
type: "Tab:Closed",
tabID: this.id
}
};
sendMessageToJava(message);
},
set active(aActive) {