This commit is contained in:
jonathandicarlo@jonathan-dicarlos-macbook-pro.local 2009-01-15 14:06:00 -08:00
Родитель bb5eead71b 476672bf55
Коммит 0b5d7072fd
4 изменённых файлов: 28 добавлений и 9 удалений

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

@ -296,13 +296,16 @@ SyncEngine.prototype = {
yield newitems.get(self.cb);
let item;
let count = {applied: 0, reconciled: 0};
this._lastSyncTmp = 0;
while ((item = yield newitems.iter.next(self.cb))) {
this._lowMemCheck();
yield item.decrypt(self.cb, ID.get('WeaveCryptoID').password);
if (yield this._reconcile.async(this, self.cb, item))
if (yield this._reconcile.async(this, self.cb, item)) {
count.applied++;
yield this._applyIncoming.async(this, self.cb, item);
else {
} else {
count.reconciled++;
this._log.trace("Skipping reconciled incoming item " + item.id);
if (this._lastSyncTmp < item.modified)
this._lastSyncTmp = item.modified;
@ -311,6 +314,9 @@ SyncEngine.prototype = {
if (this.lastSync < this._lastSyncTmp)
this.lastSync = this._lastSyncTmp;
this._log.info("Applied " + count.applied + " records, reconciled " +
count.reconciled + " records");
// try to free some memory
this._store.cache.clear();
Cu.forceGC();
@ -387,7 +393,7 @@ SyncEngine.prototype = {
let self = yield;
this._log.trace("Incoming:\n" + item);
try {
this._tracker.ignoreID(item.id);
this._tracker.ignoreAll = true;
yield this._store.applyIncoming(self.cb, item);
if (this._lastSyncTmp < item.modified)
this._lastSyncTmp = item.modified;
@ -395,7 +401,7 @@ SyncEngine.prototype = {
this._log.warn("Error while applying incoming record: " +
(e.message? e.message : e));
} finally {
this._tracker.unignoreID(item.id);
this._tracker.ignoreAll = false;
}
},
@ -434,7 +440,7 @@ SyncEngine.prototype = {
}
}
this._log.debug("Uploading " + outnum + " records + " + count + " index/depth records)");
this._log.info("Uploading " + outnum + " records + " + count + " index/depth records)");
// do the upload
yield up.post(self.cb);

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

@ -634,6 +634,13 @@ BookmarksTracker.prototype = {
return bms;
},
get _ls() {
let ls = Cc["@mozilla.org/browser/livemark-service;2"].
getService(Ci.nsILivemarkService);
this.__defineGetter__("_ls", function() ls);
return ls;
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsINavBookmarkObserver]),
_init: function BMT__init() {
@ -672,6 +679,8 @@ BookmarksTracker.prototype = {
},
onItemAdded: function BMT_onEndUpdateBatch(itemId, folder, index) {
if (this._ls.isLivemark(folder))
return;
this._log.trace("onItemAdded: " + itemId);
this._all[itemId] = this._bms.getItemGUID(itemId);
if (this.addChangedID(this._all[itemId]))
@ -679,6 +688,8 @@ BookmarksTracker.prototype = {
},
onItemRemoved: function BMT_onItemRemoved(itemId, folder, index) {
if (this._ls.isLivemark(folder))
return;
this._log.trace("onItemRemoved: " + itemId);
if (this.addChangedID(this._all[itemId]))
this._upScore();
@ -686,6 +697,8 @@ BookmarksTracker.prototype = {
},
onItemChanged: function BMT_onItemChanged(itemId, property, isAnno, value) {
if (this._ls.isLivemark(this._bms.getFolderIdForItem(itemId))
return;
this._log.trace("onItemChanged: " + itemId +
(", " + property + (isAnno? " (anno)" : "")) +
(value? (" = \"" + value + "\"") : ""));

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

@ -446,8 +446,7 @@ HistoryTracker.prototype = {
// FIXME: very roundabout way of getting url -> guid mapping!
// FIXME2: not updated after startup
let store = new HistoryStore();
let all = store.getAllIDs();
let all = this._store.getAllIDs();
this._all = {};
for (let guid in all) {
this._all[all[guid]] = guid;

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

@ -77,6 +77,7 @@ Tracker.prototype = {
this._log = Log4Moz.repository.getLogger(this._logName);
this._score = 0;
this._ignored = [];
this.ignoreAll = false;
this.loadChangedIDs();
},
@ -171,7 +172,7 @@ Tracker.prototype = {
this._log.warn("Attempted to add undefined ID to tracker");
return false;
}
if (id in this._ignored)
if (this.ignoreAll || (id in this._ignored))
return false;
if (!this.changedIDs[id]) {
this._log.debug("Adding changed ID " + id);
@ -186,7 +187,7 @@ Tracker.prototype = {
this._log.warn("Attempted to remove undefined ID to tracker");
return false;
}
if (id in this._ignored)
if (this.ignoreAll || (id in this._ignored))
return false;
if (this.changedIDs[id]) {
this._log.debug("Removing changed ID " + id);