mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 1186714 - bookmark backup yields the event loop occasionally to reduce jank. r=mak
This commit is contained in:
parent
a48ff64fe9
commit
5de13ebb49
@ -1921,6 +1921,7 @@ this.PlacesUtils = {
|
||||
{ tags_folder: PlacesUtils.tagsFolderId,
|
||||
charset_anno: PlacesUtils.CHARSET_ANNO,
|
||||
item_guid: aItemGuid });
|
||||
let yieldCounter = 0;
|
||||
for (let row of rows) {
|
||||
let item;
|
||||
if (!rootItem) {
|
||||
@ -1959,6 +1960,14 @@ this.PlacesUtils = {
|
||||
|
||||
if (item.type == this.TYPE_X_MOZ_PLACE_CONTAINER)
|
||||
parentsMap.set(item.guid, item);
|
||||
|
||||
// With many bookmarks we end up stealing the CPU - even with yielding!
|
||||
// So we let everyone else have a go every few items (bug 1186714).
|
||||
if (++yieldCounter % 50 == 0) {
|
||||
yield new Promise(resolve => {
|
||||
Services.tm.currentThread.dispatch(resolve, Ci.nsIThread.DISPATCH_NORMAL);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return rootItem;
|
||||
|
Loading…
Reference in New Issue
Block a user