Merge backout of changeset fb56f835e52d due to test failure and leaks.
authorL. David Baron <dbaron@dbaron.org>
Wed, 06 Aug 2008 11:54:04 -0700
changeset 16443 59569994531e6758b0a5e12b40ba2408c217d0d3
parent 16441 0ae6f915dd4fc9fa724f1aa4d71b821aa3876532 (current diff)
parent 16442 10af545c05119be7e032f18036c0dde02675033c (diff)
child 16445 5ed2c3ebf4f597a6222fac550d0f108a88b113da
push id1040
push userdbaron@mozilla.com
push dateWed, 06 Aug 2008 18:54:43 +0000
treeherdermozilla-central@59569994531e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone1.9.1a2pre
Merge backout of changeset fb56f835e52d due to test failure and leaks.
--- a/toolkit/components/places/src/nsLivemarkService.js
+++ b/toolkit/components/places/src/nsLivemarkService.js
@@ -21,17 +21,16 @@
  * Contributor(s):
  *   Annie Sullivan <annie.sullivan@gmail.com> (C++ author)
  *   Joe Hughes <joe@retrovirus.com>
  *   Vladimir Vukicevic <vladimir@pobox.com>
  *   Masayuki Nakano <masayuki@d-toybox.com>
  *   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
  * (the "GPL"), or the GNU Lesser General Public License Version 2.1
  * or later (the "LGPL"), in which case the provisions of the GPL or
  * the LGPL are applicable instead of those above. If you wish to
  * allow use of your version of this file only under the terms of
  * either the GPL or the LGPL, and not to allow others to use your
@@ -81,22 +80,16 @@ const FP_CONTRACTID = "@mozilla.org/feed
 const SEC_CONTRACTID = "@mozilla.org/scriptsecuritymanager;1";
 const IS_CONTRACTID = "@mozilla.org/widget/idleservice;1";
 const SEC_FLAGS = Ci.nsIScriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL;
 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;
 
 // Don't check when the user is idle for longer than half an hour
 const IDLE_TIMELIMIT = 1800000;
 
 // We should check for expiration _at least_ every hour
 // This cap is used only if the user sets a very high expiration time (>4h)
@@ -143,28 +136,16 @@ function LivemarkService() {
     var livemarkRefresh =
       prefs.getIntPref("browser.bookmarks.livemark_refresh_seconds");
     // Reset global expiration variable to reflect hidden pref (in ms)
     // with a lower limit of 1 minute (60000 ms)
     gExpiration = Math.max(livemarkRefresh * 1000, 60000);
   }
   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 = [];
 
   this._loading = GetString("bookmarksLivemarkLoading") || DEFAULT_LOAD_MSG;
   this._observerServiceObserver =
     new G_ObserverServiceObserver('xpcom-shutdown',
                                   BindToObject(this._shutdown, this),
                                   true /*only once*/);
@@ -205,16 +186,20 @@ LivemarkService.prototype = {
   _updateTimer: null,
   start: function LS_start() {
     if (this._updateTimer)
       return;
     // start is called in delayed startup, 5s after browser startup
     // 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) {
     // returns new length of _livemarks
     return this._livemarks.push({folderId: aFolderId, feedURI: aFeedURI,
                                  loadingId: -1});
   },
 
@@ -237,40 +222,20 @@ LivemarkService.prototype = {
 
     // kill timer
     if (this._updateTimer) {
       this._updateTimer.cancel();
       this._updateTimer = null;
     }
   },
 
-  // 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);
     }
   },
 
   deleteLivemarkChildren: function LS_deleteLivemarkChildren(aFolderId) {
     this._bms.removeFolderChildren(aFolderId);
   },
 
   insertLivemarkLoadingItem: function LS_insertLivemarkLoading(aBms, aLivemark) {
--- a/toolkit/components/places/tests/chrome/Makefile.in
+++ b/toolkit/components/places/tests/chrome/Makefile.in
@@ -47,17 +47,16 @@ include $(topsrcdir)/config/rules.mk
 _HTTP_FILES	= \
 		sample_feed.atom \
 		bad_links.atom \
 		rss_as_html.rss \
 		rss_as_html.rss^headers^ \
 		$(NULL)
 
 _CHROME_FILES	= \
-		test_329534.xul \
 		test_371798.xul \
 		test_342484.xul \
 		test_341972a.xul \
 		test_381357.xul \
 		test_423060.xul \
 		$(NULL)
 
 libs:: $(_HTTP_FILES)