зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1186714 - bookmark backup yields the event loop occasionally to reduce jank. r=mak
This commit is contained in:
Родитель
a48ff64fe9
Коммит
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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче