Merge backout of changeset fb56f835e52d due to test failure and leaks.

This commit is contained in:
L. David Baron 2008-08-06 11:54:04 -07:00
Родитель cf38ccf420 ec79daa1f1
Коммит d085d73186
2 изменённых файлов: 7 добавлений и 43 удалений

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

@ -26,7 +26,6 @@
* Robert Sayre <sayrer@gmail.com> (JS port)
* Phil Ringnalda <philringnalda@gmail.com>
* Marco Bonardo <mak77@supereva.it>
* Takeshi Ichimaru <ayakawa.m@gmail.com>
*
* Alternatively, the contents of this file may be used under the
* terms of either the GNU General Public License Version 2 or later
@ -86,12 +85,6 @@ const NS_BINDING_ABORTED = 0x804b0002;
// Expire livemarks after 1 hour by default
var gExpiration = 3600000;
// Number of livemarks that are read at one
var gLimitCount = 1;
// Interval when livemarks are loaded
var gDelayTime = 3;
// Expire livemarks after 10 minutes on error
const ERROR_EXPIRATION = 600000;
@ -148,18 +141,6 @@ function LivemarkService() {
}
catch (ex) { }
try {
gLimitCount = prefs.getIntPref("browser.bookmarks.livemark_refresh_limit_count");
if ( gLimitCount < 1 ) gLimitCount = 1;
}
catch (ex) { }
try {
gDelayTime = prefs.getIntPref("browser.bookmarks.livemark_refresh_delay_time");
if ( gDelayTime < 1 ) gDelayTime = 1;
}
catch (ex) { }
// [ {folderId:, folderURI:, feedURI:, loadGroup:, locked: } ];
this._livemarks = [];
@ -210,6 +191,10 @@ LivemarkService.prototype = {
// we do a first check of the livemarks here, next checks will be on timer
// browser start => 5s => this.start() => check => refresh_time => check
this._checkAllLivemarks();
// the refresh time is calculated from the expiration time, but with a cap
var refresh_time = Math.min(Math.floor(gExpiration / 4), MAX_REFRESH_TIME);
this._updateTimer = new G_Alarm(BindToObject(this._checkAllLivemarks, this),
refresh_time, true /* repeat */);
},
_pushLivemark: function LS__pushLivemark(aFolderId, aFeedURI) {
@ -242,30 +227,10 @@ LivemarkService.prototype = {
}
},
// We try to distribute the load of the livemark update.
// load gLimitCount Livemarks per gDelayTime sec.
_nextUpdateStartIndex : 0,
_checkAllLivemarks: function LS__checkAllLivemarks() {
var startNo = this._nextUpdateStartIndex;
var count = 0;
for (var i = startNo; (i < this._livemarks.length) && (count < gLimitCount); ++i ) {
// check if livemarks are expired, update if needed
try {
if (this._updateLivemarkChildren(i, false)) count++;
}
catch (ex) { }
this._nextUpdateStartIndex = i+1;
}
if ( this._nextUpdateStartIndex >= this._livemarks.length ) {
// all livemarks are checked, sleeping until next period
this._nextUpdateStartIndex = 0;
var refresh_time = Math.min(Math.floor(gExpiration / 4), MAX_REFRESH_TIME);
this._updateTimer = new G_Alarm(BindToObject(this._checkAllLivemarks, this),
refresh_time);
} else {
// wait gDelayTime sec.
this._updateTimer = new G_Alarm(BindToObject(this._checkAllLivemarks, this),
gDelayTime*1000);
// check if livemarks are expired, update if needed
for (var i = 0; i < this._livemarks.length; ++i) {
this._updateLivemarkChildren(i, false);
}
},

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

@ -52,7 +52,6 @@ _HTTP_FILES = \
$(NULL)
_CHROME_FILES = \
test_329534.xul \
test_371798.xul \
test_342484.xul \
test_341972a.xul \