Bug 507296 - Sync bookmarks and history in batched mode. r=thunder

Wrap the original SyncEngine._sync function with a call to runInBatchMode, so SQL disk writes happen at the end of batch mode instead of on every change.
This commit is contained in:
Edward Lee 2009-07-30 11:52:26 -07:00
parent 96db27a500
commit a77e420a8a
3 changed files with 14 additions and 1 deletions

View File

@ -87,7 +87,13 @@ BookmarksEngine.prototype = {
logName: "Bookmarks",
_recordObj: PlacesItem,
_storeObj: BookmarksStore,
_trackerObj: BookmarksTracker
_trackerObj: BookmarksTracker,
_sync: function BookmarksEngine__sync() {
Svc.Bookmark.runInBatchMode({
runBatched: Utils.bind2(this, SyncEngine.prototype._sync)
}, null);
}
};
function BookmarksStore() {

View File

@ -62,6 +62,12 @@ HistoryEngine.prototype = {
_storeObj: HistoryStore,
_trackerObj: HistoryTracker,
_sync: function HistoryEngine__sync() {
Svc.History.runInBatchMode({
runBatched: Utils.bind2(this, SyncEngine.prototype._sync)
}, null);
},
// History reconciliation is simpler than the default one from SyncEngine,
// because we have the advantage that we can use the URI as a definitive
// check for local existence of incoming items. The steps are as follows:

View File

@ -726,6 +726,7 @@ Svc.Prefs = new Preferences(PREFS_BRANCH);
["Bookmark", "@mozilla.org/browser/nav-bookmarks-service;1", "nsINavBookmarksService"],
["Crypto", "@labs.mozilla.com/Weave/Crypto;1", "IWeaveCrypto"],
["Directory", "@mozilla.org/file/directory_service;1", "nsIProperties"],
["History", "@mozilla.org/browser/nav-history-service;1", "nsINavHistoryService"],
["Idle", "@mozilla.org/widget/idleservice;1", "nsIIdleService"],
["IO", "@mozilla.org/network/io-service;1", "nsIIOService"],
["Login", "@mozilla.org/login-manager;1", "nsILoginManager"],