Bug 604215 - Stop Panorama's tab canvas drawing heartbeat during zoom animations; r=ian a=blocking-final+

This makes sure that we don't waste time running the heartbeat JS code and also possibly calling drawWindow when a zoom animation is in progress.  It should improve the performance of zoom animations.
This commit is contained in:
Ehsan Akhgari 2011-01-12 19:54:49 -05:00
parent 4037d5cf89
commit b0de9c6e9e

View File

@ -785,7 +785,7 @@ let TabItems = {
cachedDataCounter: 0, // total number of cached data being displayed. cachedDataCounter: 0, // total number of cached data being displayed.
tabsProgressListener: null, tabsProgressListener: null,
_tabsWaitingForUpdate: [], _tabsWaitingForUpdate: [],
_heartbeatOn: false, // see explanation at startHeartbeat() below _heartbeat: null, // see explanation at startHeartbeat() below
_heartbeatTiming: 100, // milliseconds between _checkHeartbeat() calls _heartbeatTiming: 100, // milliseconds between _checkHeartbeat() calls
_lastUpdateTime: Date.now(), _lastUpdateTime: Date.now(),
_eventListeners: [], _eventListeners: [],
@ -1053,13 +1053,12 @@ let TabItems = {
// Start a new heartbeat if there isn't one already started. // Start a new heartbeat if there isn't one already started.
// The heartbeat is a chain of setTimeout calls that allows us to spread // The heartbeat is a chain of setTimeout calls that allows us to spread
// out update calls over a period of time. // out update calls over a period of time.
// _heartbeatOn is used to make sure that we don't add multiple // _heartbeat is used to make sure that we don't add multiple
// setTimeout chains. // setTimeout chains.
startHeartbeat: function TabItems_startHeartbeat() { startHeartbeat: function TabItems_startHeartbeat() {
if (!this._heartbeatOn) { if (!this._heartbeat) {
this._heartbeatOn = true;
let self = this; let self = this;
setTimeout(function() { this._heartbeat = setTimeout(function() {
self._checkHeartbeat(); self._checkHeartbeat();
}, this._heartbeatTiming); }, this._heartbeatTiming);
} }
@ -1071,7 +1070,7 @@ let TabItems = {
// _update on them. // _update on them.
// Should only be called by startHeartbeat and resumePainting. // Should only be called by startHeartbeat and resumePainting.
_checkHeartbeat: function TabItems__checkHeartbeat() { _checkHeartbeat: function TabItems__checkHeartbeat() {
this._heartbeatOn = false; this._heartbeat = null;
if (this.isPaintingPaused()) if (this.isPaintingPaused())
return; return;
@ -1094,6 +1093,10 @@ let TabItems = {
// pausePainting needs to be mirrored with a call to <resumePainting>. // pausePainting needs to be mirrored with a call to <resumePainting>.
pausePainting: function TabItems_pausePainting() { pausePainting: function TabItems_pausePainting() {
this.paintingPaused++; this.paintingPaused++;
if (this._heartbeat) {
clearTimeout(this._heartbeat);
this._heartbeat = null;
}
}, },
// ---------- // ----------