Bug 1261657 - Don't record SSTabRestored events in StartupPerformance that are the result of a remoteness flip. r=Yoric

MozReview-Commit-ID: 2pnT2DdKPHV

--HG--
extra : rebase_source : f64f2007b7738c259996402a722b3a9bfcab5e0d
This commit is contained in:
Mike Conley 2016-04-03 00:30:14 -04:00
Родитель 5bb643ae93
Коммит 9b79809916
3 изменённых файлов: 30 добавлений и 13 удалений

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

@ -838,7 +838,7 @@ var SessionStoreInternal = {
SessionStoreInternal._resetLocalTabRestoringState(tab);
SessionStoreInternal.restoreNextTab();
this._sendTabRestoredNotification(tab);
this._sendTabRestoredNotification(tab, data.isRemotenessUpdate);
break;
case "SessionStore:crashedTabRevived":
// The browser was revived by navigating to a different page
@ -3286,6 +3286,9 @@ var SessionStoreInternal = {
* the tab to restore
* @param aLoadArguments
* optional load arguments used for loadURI()
* @param aRemotenessSwitch
* true if we're restoring a tab's content because we flipped
* its remoteness (out-of-process) state.
*/
restoreTabContent: function (aTab, aLoadArguments = null) {
if (aTab.hasAttribute("customizemode")) {
@ -3309,7 +3312,8 @@ var SessionStoreInternal = {
// flip the remoteness of any browser that is not being displayed.
this.markTabAsRestoring(aTab);
if (tabbrowser.updateBrowserRemotenessByURL(browser, uri)) {
let isRemotenessUpdate = tabbrowser.updateBrowserRemotenessByURL(browser, uri);
if (isRemotenessUpdate) {
// We updated the remoteness, so we need to send the history down again.
//
// Start a new epoch to discard all frame script messages relating to a
@ -3332,7 +3336,7 @@ var SessionStoreInternal = {
}
browser.messageManager.sendAsyncMessage("SessionStore:restoreTabContent",
{loadArguments: aLoadArguments});
{loadArguments: aLoadArguments, isRemotenessUpdate});
},
/**
@ -3977,11 +3981,17 @@ var SessionStoreInternal = {
/**
* Dispatch the SSTabRestored event for the given tab.
* @param aTab the which has been restored
* @param aTab
* The tab which has been restored
* @param aIsRemotenessUpdate
* True if this tab was restored due to flip from running from
* out-of-main-process to in-main-process or vice-versa.
*/
_sendTabRestoredNotification: function ssi_sendTabRestoredNotification(aTab) {
let event = aTab.ownerDocument.createEvent("Events");
event.initEvent("SSTabRestored", true, false);
_sendTabRestoredNotification(aTab, aIsRemotenessUpdate) {
let event = aTab.ownerDocument.createEvent("CustomEvent");
event.initCustomEvent("SSTabRestored", true, false, {
isRemotenessUpdate: aIsRemotenessUpdate,
});
aTab.dispatchEvent(event);
},

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

@ -199,9 +199,16 @@ this.StartupPerformance = {
// to reach that point.
let win = subject;
let observer = () => {
this._latestRestoredTimeStamp = Date.now();
this._totalNumberOfEagerTabs += 1;
let observer = (event) => {
// We don't care about tab restorations that are due to
// a browser flipping from out-of-main-process to in-main-process
// or vice-versa. We only care about restorations that are due
// to the user switching to a lazily restored tab, or for tabs
// that are restoring eagerly.
if (!event.detail.isRemotenessUpdate) {
this._latestRestoredTimeStamp = Date.now();
this._totalNumberOfEagerTabs += 1;
}
};
win.gBrowser.tabContainer.addEventListener("SSTabRestored", observer);
this._totalNumberOfTabs += win.gBrowser.tabContainer.itemCount;

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

@ -167,21 +167,21 @@ var MessageListener = {
sendSyncMessage("SessionStore:restoreHistoryComplete", {epoch});
},
restoreTabContent({loadArguments}) {
restoreTabContent({loadArguments, isRemotenessUpdate}) {
let epoch = gCurrentEpoch;
// We need to pass the value of didStartLoad back to SessionStore.jsm.
let didStartLoad = gContentRestore.restoreTabContent(loadArguments, () => {
// Tell SessionStore.jsm that it may want to restore some more tabs,
// since it restores a max of MAX_CONCURRENT_TAB_RESTORES at a time.
sendAsyncMessage("SessionStore:restoreTabContentComplete", {epoch});
sendAsyncMessage("SessionStore:restoreTabContentComplete", {epoch, isRemotenessUpdate});
});
sendAsyncMessage("SessionStore:restoreTabContentStarted", {epoch});
if (!didStartLoad) {
// Pretend that the load succeeded so that event handlers fire correctly.
sendAsyncMessage("SessionStore:restoreTabContentComplete", {epoch});
sendAsyncMessage("SessionStore:restoreTabContentComplete", {epoch, isRemotenessUpdate});
}
},